Session.Properties and inline scripts - Advanced Installer Community
stevericketts
Posts: 10
Joined: Sun Feb 12, 2006 2:50 pm

Session.Properties and inline scripts

I thought I had this figured out but... no.

I'm trying to install a codec with an .inf file. In custom actions, InstallFinalize, I create a property set with formatted called "mycodec" with formatted text of:

[SystemFolder]rundll32 setupapi,InstallHinfSection defaultInstall 128 [SystemFolder]mpg4vki.inf

This custom action is followed by an VBscript inline with script text of:
session.property("mycodec")

Upon installation it errors out with a VBscript error that shows "session.property("mycodec") rather than the value of the property. If I replace the script text with:

msgbox(session.property("mycodec")) it displays correctly:

C:\WINNT\system32\rundll32 setupapi,InstallHinfSection defaultInstall 128 C:\WINNT\system32\mpg4vki.inf

Why does it convert to the right value in a msgbox but not when its just the session.property itself?

I'm sure you'll know where I've gone wrong...

Steve
Ionut
Posts: 605
Joined: Tue Nov 22, 2005 11:29 am
Contact: Website

Hi,

"Session.Property" returns a read-write property (not a string) that represents the string value of a named installer property. The "MsgBox" function converts the parameter to a string (the same way it does for MsgBox(3) for example). If you set the "Script Text" to:

Code: Select all

Chr(Session.Property("mycodec"))
no error will be encountered, but still nothing will be displayed (the string returned by "Chr" is discarded).

Note that you can use an EXE with Working Directory Custom Action in order to execute the desired command. Put quotes around file names in this case. The "Full Path" text field will look like this:

Code: Select all

"[SystemFolder]rundll32" setupapi,InstallHinfSection defaultInstall 128 "[SystemFolder]mpg4vki.inf"
Regards,
Denis
Denis Toma
Advanced Installer Team
http://www.advancedinstaller.com/
stevericketts
Posts: 10
Joined: Sun Feb 12, 2006 2:50 pm

Perfect! That did the trick.

It failed the first time so I removed the quotes and it worked.

Return to “Common Problems”