Page 1 of 1

Purple commands.

Posted: Tue Feb 17, 2009 3:07 pm
by bokkie
I understand that all purple commands (assuming the default colours are used) are deferred until the Apply statement is run. Further, the purple commands are stacked up in the order they are encountered in the script.

So, if I have a script that bounces around from one piece of code to another using if and goto label statements for example, the script engine will pick up all the purple commands wherever it finds them but nothing will execute until the time the Apply Install statement is reached. At which time the purple commands will be run FIFO or perhaps ordered into an internal sequence that the engine decides is correct.

Further if bits of common code are encountered it's possible that any number of purple commands might also be eligible for inclusion in the apply install, uninstall and patch commands. That could possibly lead to unexpected results where an install-only intended purple command could be executed during an apply uninstall.

Which explains why it's important to distinguish between what gets executed during an install and uninstall using variables to control what the script does and where.

All black commands (default colours) are executed immediately wherever they are encountered.

I presume the purple commands are internal to IA only? That is, anyone writing a plug-in can only write non-purple commands?

Of course, I'm writing all of this as fact but to be truthful, I'm not sure if I've actually really understood how the purple commands work. If I'm flawed in my assumptions, then please correct me. :)

Posted: Wed Feb 18, 2009 10:30 am
by MichaelNesmith
You are mostly correct.

Purple commands have direct correlates in the MSI database. The MSIcode scripting engine magically makes it "work out" at runtime such that the purple commands you call "just work" as expected when Apply Install is called.

Then, think of Apply Uninstall as the automatic undo of whatever was done in Apply Install. If you add any new purple commands before Apply Uninstall, they won't take effect at all. You would have to call Apply Install for them to have any effect.

This creates the confusing issue that you need to schedule some uninstall-time commands during your installation stage (such as Delete Files with the Delete when Uninstalling flag). Do not attempt to call this before Apply Uninstall, instead call it before Apply Install with the proper timing flag set.

Apply Advertised and Apply Patch are exactly the same as Apply Install, except they don't do a full install but either patch or advertise based on which one of them you chose. All other conditions fully apply as per usual.

Plug-In commands are highlighted in teal color, so yes they can never be purple :) And while there hasn't been an InstallAware or third party built plug-in so far which works with the MSI database (it's just easier to work natively with the target system most of the time), it's certainly possible - the plug-in gets a handle to the MSI database being built at compile time and also can manipulate that database as runtime just like MSIcode does.

Last but not least, black commands...are directly executing commands as you have figured. These are reserved for actions which do not have direct correlates in Windows Installer tables, and therefore are implemented directly by the InstallAware engine, instead of custom actions inside the MSI database (no need for custom actions since MSIcode already offers an uber-bootstrapper).

One last important point is the following. Even though it is legal to construct an MSIcode loop in your installer which loops purple commands, you have to realize that only the last iteration of your loop will have any effect. This is because the MSI database contains only one set of entries for each purple command, and these entries are updated by the MSIcode engine at runtime so the scripting magic works - but if you loop over purple commands, you are updating the same entries over and over again.

So that's the story of the colored lines for you :) This is discussed in detail in the MSIcode Scripting whitepaper for those of you who are interested in finding out more.

Posted: Wed Feb 18, 2009 11:09 am
by bokkie
Michael, I should have remembered from my IS days having to shoot-from-the-hip editing the MSI tables, that MSIcode would update the tables internally and safer too. I also recall the number of times I broke my IS projects with incorrect edits to the tables. Those MSI tables are not the faint-hearted.

Purple rules. :lol:

Posted: Wed Feb 18, 2009 11:14 am
by MichaelNesmith
Some good experiments are:

1. Create an empty MSIcode script, build. Open the MSI file in Orca and inspect the "baseline" MSI built by the InstallAware compiler.

2. Add a single Install Files command to the script, which installs a single file. Rebuild and inspect the File table.

3. Update the Install Files command to use wildcards so it installs more than one file. Re-inspect the MSI which now contains multiple entries in the File table.

And you'll start to get an idea of how the MSIcode magic and the InstallAware compiler works behind the scenes ;)

And slowly but surely an appreciation ought to develop for the InstallAware compiler and how it makes all other Windows Installer tools look like stone age tools/rocket science ;)

Posted: Wed Feb 18, 2009 2:36 pm
by bokkie
100%.

I did as you suggested and using Orca to view all the tables in the msi proved how effective IA is at producing what's needed. I remember IS would write all sorts of stuff into the tables. True, the more complex the installation is the more tables need updating. One frustrating thing I used to contend with is that if you delete items from the installation some of the tables still contained residues of the files and so on. If you added the file back in again there'd be new records created leaving dangling references to the originals which you could not take a chance on manually removing.

I never once found a satisfactory document that described the relationships among the tables and with over 70 of them (last time I counted) it's a complicated database. I was asked once to produce a diagram of the schema but where the heck do you begin?

From where I sit, you guys at IA do a much more commendable job of populating the tables.

Posted: Tue Oct 20, 2009 9:38 pm
by Tiago
Hi there!

As a IA customer, I've been working on InstallAware for the last few months and now I can say I'm somewhat experienced on using these beautiful purple lines. But I must confess that they still confuse me while running my installer in Maintenance Mode to Add/Remove previously installed components (MODIFY). How do these comands behave in such a situation? How can I remove from the computer a component that was selected before but is now unselected, while keeping the other components unchanged? In the default template, Apply Uninstall will remove everything and Apply Install only installs the new selected items...

What can I do?

Thanks in advance.

Posted: Wed Oct 21, 2009 6:25 am
by MichaelNesmith
Excellent question. As described in the MSIcode whitepaper, purple commands that don't execute in a new pass of the script are automatically rolled-back when Apply Uninstall is called.

This means you don't have to manually author in, for example, Delete Files commands for Install Files commands that had previously executed. If they don't run in your latest iteration, they'll be un-done auto-magically.

Otherwise it'd be a nightmare maintaining your script :lol:

Re: Purple commands.

Posted: Tue Nov 29, 2011 6:20 pm
by QAGuru
Hello,
I am very new to IA and have successfully converted and build my first installer from Wise script. When I ran the installers, it doesn't do anything i.e it doesn't install the files on my test machine.
I do have the "purple lines" in the converted script and I suspecting it's the culprit. When I look on the right hand side, I do not see "Apply Install" command so I am a bit confused. Any help will be greatly appreciated. Thanks

Re: Purple commands.

Posted: Wed Nov 30, 2011 1:46 pm
by giaviv
Hi,

Your Apply Install command is probably later down in the script. Which template did you use to create your setup?

Re: Purple commands.

Posted: Tue Feb 07, 2012 4:05 pm
by isatterfield
I would like to know what the color coding in the MSI scripting represents, but I did a search in (and actually read) the white paper referenced and couldn't find anything on color-coding.
In particular, I would like to know about dark green color for Call DLL, the blue and maroon colors as well and if they hold any particular meaning.
Thanks so much!

Re: Purple commands.

Posted: Wed Feb 08, 2012 11:47 pm
by giaviv
Hi,

This will all appear in IA's settings - you can even define custom colors for your commands!