Page 1 of 1
Common entry point for installation and uninstallation.
Posted: Wed Feb 11, 2009 9:14 am
by bokkie
In the MSIcode window is there a common place that both the installation and uninstallation would use? I can't quite see it if there is one. What I'm looking for is a place where I could create and initialise variables which I'd like to be eligible for use both when installing and uninstalling, that sort of thing. Another trivial example is maybe writing to a log file when the application is installed and uninstalled.
Posted: Wed Feb 11, 2009 9:53 am
by StyX
Short version:
Entry point for booth is line 1.
Long version:
Booth the installer and uninstaller start at the top of the code and work their way through. In my setup that I'm working on currently (which I think is at least close to the default one generated if you use the wizard) what decides if it's installing or uninstalling is if the MAINTENANCE varible is set to true and NEEDSUPGRADE equals false then you are only uninstalling.
If NEEDSUPGRADE is set to true it will first uninstall and then go back and run the install part.
What I've done for easy access to all of my variables is simply placing them inside their own Code folding region at the top of the script. So the first thing the installer does is go through and initialize the varibles that I will need to install and uninstall. I've messed around alittle here and tried placing them different places and I can't see any difference preformance wise if I only initialize the varibles I need in order to install and not just do all like I do now.
Posted: Wed Feb 11, 2009 10:04 am
by bokkie
Styx,
If I understand you correctly, execution is therefore always linear starting from line 1 until such time as the code branches or makes other decisions?
That's fine with me as line 1 is always a nice place to start!

Posted: Wed Feb 11, 2009 10:11 am
by StyX
Yes.....
MSIcode regions.
Posted: Wed Feb 11, 2009 10:29 am
by bokkie
A little off topic perhaps but is it possible to wrap code in a Define Region. I can see other regions but I can't find anything in the MSIcode window that would let me insert a region of my own. I guess it's possible but I can't see how to.
Posted: Wed Feb 11, 2009 10:31 am
by StyX
Select a line and type: Code folding region.
Then hit Enter.
Posted: Wed Feb 11, 2009 10:42 am
by bokkie
StyX wrote:Select a line and type: Code folding region.
Then hit Enter.
If that was snake it would have bitten me.
I was looking for Define Region. Doh! (slapping forehead).
Posted: Wed Feb 11, 2009 11:13 am
by StyX
hehe, I did the exact same thing
Darn Visual Studio shortcut is to blame :p
Posted: Wed Feb 11, 2009 1:53 pm
by MichaelNesmith
By the way folks, initializing variables all the way on top is fine, but pre-generated Install
Aware scripts generally do this in the
Define Setup Globals code folding region, and they initialize variables which should only be initialized on first run inside the
Setup User Interview code folding region, right below the comment
First Time Install. You can do the same or do it your way, nothing is hard coded in Install
Aware, so do as you please
One important note is if you do not want to re-initialize variables with default values on further runs of setup (i.e. you want the values assigned on first run, possibly by the end-user, to survive), check the
Remember value when restarting setup option in the
Set Variable command window.
Posted: Wed Feb 11, 2009 3:16 pm
by bokkie
MichaelNesmith wrote:One important note is if you do not want to re-initialize variables with default values on further runs of setup (i.e. you want the values assigned on first run, possibly by the end-user, to survive), check the Remember value when restarting setup option in the Set Variable command window.
Nice. I can see a use for that.