View Full Version : unable to access session properties

11-11-2004, 01:23 AM
I'm trying to write a custom action that does some maintenance in the installation directory but for the life of me cannot get the install directory out of the Session. I've tried Session.Property("INSTALLDIR") like I've seen suggested elsewhere but I just get a blank string. My vbscript is running at the Before File Transfer step in the custom actions.
I'm using the demo version of InstallShield X Express in case that has an effect because I want to make sure my stuff will work before I fork over the money.

At this point the vbscript method I have is:
Sub aMethod()
MsgBox Session.Property("INSTALLDIR")
End Sub

I've also tried Session.TargetPath("INSTALLDIR") but that just crashes my installation with error 1720.

Any ideas what I'm doing wrong?

Thanks in advance,

11-11-2004, 02:22 AM
Only a limited set of properties are available during deferred execution sequence. MSI Properties and Deferred Execution (http://www.installshield.com/news/newsletter/0308-articles/CustomActionData.asp) will provide background information on the Windows Installer limitation and the expected approach to work around the limitation.

11-11-2004, 02:56 AM

I believe that I have run into the same problem. The parameters sent to the DLL are blank. After some testing I discovered that the parameters are NOT available in "before file transfer" but you must call the DLL earlier. "After ready to install dialog" works for me. I believe this must be a bug. It is not mentioned that the parameters shouldn't be available. What puzzles me is that from "after file transfer" and forward, the parameters are not passed to the DLL. This is clearly stated in the help. WHY is this? The installed directory will not change after that stage so why not pass all the parameters? Imagine that you want to change a file after it has been installed, tough luck since you cannot send the installdir to the DLL!! What I have to do know is to write the installdir to the registry in "ready to install dialog" and then after file transfer, call another routine that reads the registry and use that info to change the file. This MUST be a bug or something. Let me know if this solves your problem.

11-11-2004, 01:00 PM
nitsev, the fact that most properties are not available during deferred execution sequence IS by design, and is NOT a bug. The article I mentioned in my earlier post would provide some background information. If you haven't, you would want to read up on that. For additional information, please look up CustomActionData or deferred custom action in MSDN.