View Full Version : Changing INSTALLDIR via custom action

11-08-2004, 05:22 PM
I have a custom action (set to “After Install Welcome Dialog”) to run a VBScript file that uses trail and error to determine the correct initial installation directory. It checks one registry key which may or may not be present. If it is great, it sets Session.Property(“INSTALLDIR”) to that value. If it is not present it check another registry key, if found great set Session.Property(“INSTALLDIR”). If both of these checks fail it set Session.Property(“INSTALLDIR”) to the Program Files directory followed by the Session.Property(“ProductName”) value. Through a series of MsgBox’s I can see that this works great.

The Destination Folder dialog has the correct path set from the above vbs script. The “Ready to Install Dialog” also has the correct path. The problem is that once the install starts the actual directory used is the one set in the InstallShield X Express project file (General Information / INSTALLDIR) but an empty subdirectory is created in the correct location.

General Information / INSTALLDIR = [ProgramFilesFolder]EMS which works out to E:\Program Files\EMS

INSTALLDIR set to C:\Utilities\EMS via the vbs script custom action.

E:\Program Files\EMS created and all files copied here
C:\Utilities\EMS created but empty.

As a side note: If I click Change… on the Destination Folder dialog and then just hit Ok to the file browser (accept the vbs script generated destination folder) then it works.

I see from the note at the bottom of http://www.installshield.com/news/newsletter/0302-articles/msiaccess.asp that “temporary modifications to a database made in the User Interface sequence will be lost when execution switches to the Execute sequence.” so this explains why the script changes to INSTALLDIR is not taking but what is the Change… dialog setting to cause it to take?

Mike Marino
11-08-2004, 11:05 PM
Are you using Session.TargetPath?

Your code should look something like:

Session.TargetPath("INSTALLDIR") = "C:\NewPath"

11-09-2004, 09:23 AM
No I wasn't. That did the trick. Thank you.