Community Forums
Results 1 to 4 of 4

Thread: unable to access session properties

  1. #1
    Join Date
    Nov 2004
    Posts
    2

    unable to access session properties

    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,
    Seth

  2. #2
    Join Date
    Jan 2002
    Location
    Oakland, CA, USA
    Posts
    5,427
    Only a limited set of properties are available during deferred execution sequence. MSI Properties and Deferred Execution will provide background information on the Windows Installer limitation and the expected approach to work around the limitation.
    Tsung-Huang Hsieh
    "A problem well stated is a problem half solved." --Charles F. Kettering

  3. #3
    Join Date
    Apr 2002
    Location
    Sweden
    Posts
    116

    Unhappy Session properties

    pfoorion.

    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.

  4. #4
    Join Date
    Jan 2002
    Location
    Oakland, CA, USA
    Posts
    5,427
    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.
    Tsung-Huang Hsieh
    "A problem well stated is a problem half solved." --Charles F. Kettering

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •