PDA

View Full Version : OnUninstall (Install Script) Event not called



sammathew
03-07-2008, 03:59 AM
Hi All,

I am using InstallShield 2008 .OnUninstall event in the script is not get called when the product is uninstalled.

Can anyone help me how to fix this problem and all let me know whats the reason behind this.

My advance Thanks !

Thank You.

Holger_G
03-07-2008, 06:11 AM
What type of project do you use?
1) pure InstallScript
or
2) InstallScript MSI

sammathew
03-10-2008, 04:28 AM
Hi Nick Rivers,

I appreciate you'r replie ,thanks a lot.

I am using pure InstallScript project. I went through InstallShield Help Library,which says

--------------------------------------------------------------------------
OnUninstall
InstallShield 2008 » InstallScript Language Reference

For InstallScript installations, the OnUninstall event is called when the installation is run with the -uninst parameter. This is the only event that is called when the -uninst parameter is used. The default code for the OnUninstall event uninstalls a previously installed product

--------------------------------------------------------------------------

I allso tried using that but still ,i am not able to fix the problem.The Acutal problem is when i try to uninstall the product through Start Menu ,the OnUninstall event should be called but thats not happening.

My code:

szCommand = UNINSTALL_STRING + "-uninst";

AddFolderIcon( szPgmFolder_Path ^ svFolder , "Uninstall " + @PRODUCT_NAME + " for ResumeGrabber Pro" , szCommand , TARGETDIR , TARGETDIR^"Uninst.ico", 0, "", REPLACE );

Wating for you'r replie Nike.

My advance Thanks .

bryanwolf
03-10-2008, 09:56 AM
Is there a space at the end of UNINSTALL_STRING? I'm really not sure for InstallScript, but you might try something like UNINSTALL_STRING + " -uninst" instead as a thought.

MarkEarle
03-10-2008, 12:31 PM
bryanwolf is correct. There is no space in UNINSTALL_STRING as of IS 7.0.

Cheers,

ME

sammathew
03-12-2008, 12:25 AM
Hi bryanwolf & MarkEarle,

Thanks a lot guys.It's working good.Can You allso help me for a other problem which i am facing.

The problem is when i try to uninstall the product from the control panel its calling OnMaintUIBefore but it should call OnUnistall.

It would be nice if you could help me in this.

My advance Thanks !

areatza
03-12-2008, 04:55 AM
Hello Sammathew

In InstallShield 2008 the function OnUninstall does not work, you must use OnMaintUIBefore and OnMaintUIAfter.

Holger_G
03-12-2008, 05:46 AM
Hi bryanwolf & MarkEarle,

Thanks a lot guys.It's working good.Can You allso help me for a other problem which i am facing.

The problem is when i try to uninstall the product from the control panel its calling OnMaintUIBefore but it should call OnUnistall.

It would be nice if you could help me in this.

My advance Thanks !

That´s correct. OnMaintUIBefore will be called by default. If you want to prompt for uninstall directly you could do this for example:
Add a custom command line paramater to UNINSTALL_STRING at the end of 'OnFirstUIBefore' and evaluate the commandline parameter at the beginning of 'OnMaintUIBefore' like this:

if (CMDLINE % "-uninstall") then
'put your code for uninstall here'
else
'default OnMaintUIBefore code'
endif;

sammathew
03-14-2008, 02:20 AM
Hi Nick Rivers,

I tried the code that you have mentioned .

--------------------------------------------------------------------------
if (CMDLINE % "-uninstall") then
'put your code for uninstall here'
else
'default OnMaintUIBefore code'
endif;
--------------------------------------------------------------------------

But when i debbuged the script it does'nt check the if condition.Is there any thing that i need to include in the script.If so, its my request kindly help me please.

Is there any way to find that the user is trying to uninstall the product through the control panel.If so , please let me know.

My advance Thanks!

brianthegood
07-01-2008, 12:21 PM
I've always used

if(ADDREMOVE) then

as the first line of OnMaintBefore

This was my way of preventing an uninstall experience if someone relaunched the setup. In other words users could only uninstall if they went to the Add/Remove of the control panel.

Good luck.

VivekGupta
07-02-2008, 02:46 PM
I am using IS12. If you go General Information -> Product Properties and set "Enable Maintenance" = No then it calls OnUninstallEvent. If Value is set to YES then it calls OnMaintUIBefore event.