PDA

View Full Version : Programmatically check Installing/Uninstalling



tejpalthatte
07-17-2006, 06:52 AM
Hi
How does one programmatically understand whether the setup program is installing the software or uninstalling the software ? What I mean to say is that, I have written some code in the OnEnd and the OnRebooted Events, which I want to execute only if the software is Installing. For Example, in the OnEnd event, I'm asking the user whether he wants a desktop shortcut on his desktop, and depending on that I'm adding/not adding a shortcut to the desktop. Now, I don't want this action to execute if the software is getting uninstalled. But the OnEnd event is fired at the time of uninstallation too. So, in my setup package, the software is getting uninstalled and then it is asking the user whether he wants a desktop shortcut on his desktop !!! :eek:
Furthermore, I've tried using: if (REMOVE="ALL") then <some code...>, but it gives me an error saying "numeric value required". And if I use: if (_IsMaintenance="Remove") then <some code...>, it gives me an error saying, Undefined Identifier and String Value required...... :confused:

I'm fairly new to InstallShield. It would be great if somebody can help me out on this one. :)

Thanks,
Tejpal

RobertDickau
07-17-2006, 03:13 PM
What type of project are you using? The REMOVE="ALL" condition is used by MSI (see http://www.installshield.com/news/newsletter/0212-articles/msiconditions.asp), while InstallScript uses MAINTENANCE and REMOVEALLMODE system variables for the different stages...

tejpalthatte
07-18-2006, 01:24 AM
I'm using the InstallScript project. Also, yesterday, I found out that I can write code in the OnFirstUIAfter event. Is this the solution to my problem?

tejpalthatte
07-18-2006, 03:09 AM
Hi
I've put some of my code into the OnFirstUIAfter event and my problem has been solved to an extent :) , but still there is some code which I want to run only after the system reboots after the installation has been done, and this code has been put by me in the OnRebooted event. Now, the OnRebooted Event is fired even while uninstalling, and I want my code to be run only when the system restarts after INSTALLATION and not after uninstallation. So how do I achieve this? How do I check programmatically whether the package is doing an INSTALL or an UNINSTALL of the software? :confused: I'm using an InstallScript Project.

Regards,
Tejpal

RobertDickau
07-18-2006, 08:34 AM
You might see if the InstallScript MAINTENANCE and REMOVEALLMODE system variables will be of use...

tejpalthatte
07-19-2006, 12:30 AM
Thanks for your help Robert !!!!! I used the REMOVEALLMODE variable and it is working fine now..... :D

Regards,
Tejpal