PDA

View Full Version : How do I perform uninstallation within my script's maintenance-only code section?



Kieran Jones
02-03-2005, 06:54 PM
- using procedural InstallScript (uses program/endprogram, not event-driven).
- script successfully auto-converted to 10.5 from 5.5.
- script installs product successfully.
- invokes CreateInstallationInfo() and MaintenanceStart().
- script contains if (!MAINTENANCE) ...endif block to perform installation code. Works correctly.
- script also contains if (MAINTENANCE)...endif block to perform file cleanup code that should be run during UNinstallation when Remove button in Add/Remove Programs panel is clicked.
- this code runs OK and script exits, but actual uninstallation operations are never performed.
- do I need additional code in my maintenance-only section to cause IS to actually perform the standard uninstallation along with my custom cleanup?

Kieran

Kieran Jones
02-03-2005, 07:44 PM
A call to the OnUninstall() function must be made within the maintenance-only code to make the uninstallation actually occur.

Kieran

saurabhs
02-04-2005, 08:10 AM
Hi,
I am also facing the same problem.

I am using InstallShield 10.5 to make setup for a project.

I need to execute few InstallScript functions along with the default uninstall functions of InstallShield.
So I am calling SdWelcomeMaint from function OnMaintUIBefore() to display the Maintenance welcome screen and depending upon the value returned (REMOVEALL or REPAIR) I am calling few functions (using Switch- Case).

The problem is that only these functions get executed but the default built in uninstallation functions like- removing the copied files(files copied using wizard) etc are not getting called.
I want to do both i.e call my functions as well as execute the default uninstallation functions.
If I dont call this SdWelcomeMaint function, though Maintenance Welcome screen comes up and default uninstallation functions too get executed BUT then I cannot call my own functions.

Can anyone help me in this.
I am including the script below this mail.
Is there any built in global variable which can tell me in OnMaintUIBefore/After function, that Maint function has been called due to REPAIR option or REMOVEALL option.

regards,
Saurabh

This script only deletes websites during REMOVEALL but does not removes the file.

function OnMaintUIBefore()
string szTitle;
number nType;
begin
szTitle="";
nMaintReturn = SdWelcomeMaint (szTitle, "", nType);
switch(nMaintReturn)

case REMOVEALL:
SdShowMsg(@DELETE_WEBSITES,TRUE);
LaunchAppAndWait(SUPPORTDIR + "Delete_Websites.cmd","",LAAW_OPTION_WAIT);
SdShowMsg(@DELETE_WEBSITES,FALSE);
endswitch;
end;

function OnMaintUIAfter()

string szTitle;
string szMsg1;
string szMsg2;
string szOpt1;
string szOpt2;
BOOL bvOpt1;
BOOL bvOpt2;

begin

szTitle="";
szMsg1="";
szMsg2="";
szOpt1="";
szOpt2="";
SdFinish ( szTitle, szMsg1, szMsg2, szOpt1, szOpt2, bvOpt1, bvOpt2 );

end;

chrishein
02-09-2005, 04:20 PM
Hi Saurabh,
You need to make sure that you call the functions that launch the uninstall data. Take a look at a default script with OnMaintUIBefore. You need to make sure that you have a call to FeatureRemoveAllInMedia(); to uninstall the info put in your install.

Chris