sjwells
Posts: 6
Joined: Thu Jun 23, 2005 12:04 pm

Help with Inline Script Custom Action

Please can someone explain how to add inline vbscript to a custom action
that allows passing of a windows installer property.

Also how can you add script when the script text drop down only allows one line of text i've tried holding ALT+ENTER to create a new line but nothing happens.

I've tried typing msgbox [TARGETDIR] into the Script Text box under ScriptInline but nothing seems to happen.

The help file stops being usefull as soon as you want to do something involving custom actions.
You need screen dumps of the program, loads of examples and walk throughs throughout showing exactly where and how to edit code.
Mike
Posts: 292
Joined: Wed Jun 01, 2005 10:50 am
Location: Craiova, Romania
Contact: Website

Hi,

In order to access a property's value in a script you have to use the script's language specific syntax. In the case of VBScript, for example, this inline script shows a message box with the value of a property:

MsgBox("The property is: " + Session.property("MY_PROPERTY"))

The inline script feature is used for small scripts. If you want to use a multi line script separate two consecutive statements with the ":" character.

Example:

MsgBox "Hello" : MsgBox "Hello again"

Another solution when dealing with a multi line script is creating a file containing it and use the "New Attached Custom Action" option from the context-menu. In the window that appears select the file containing your script.

As for the more detailed help, thank you for your suggestions. We are working on a series of articles and tutorials to be included in a future release.

All the best,
Mihai
Mihai Bobaru
Advanced Installer Team
http://www.advancedinstaller.com
sjwells
Posts: 6
Joined: Thu Jun 23, 2005 12:04 pm

thanks for the prompt reply.

Ok i've tried that and no joy,

I've added 'MsgBox "Hello"' to the Begin standard action script text, selected the default 'Syncronous execution, check return code' and put 'true' in the Expression box.

The custom action was called ScriptInline_1

Shouldn't i at least get an error message rather than nothing if there's something wrong?

Theres no reference in the log file to my custom action

Has anyone got an .aip file for an installation containing custom actions.
I should be able to work out from example where i'm going wrong.
sjwells
Posts: 6
Joined: Thu Jun 23, 2005 12:04 pm

OK Problem solved.
For anyone else who may have got stuck at the same point.

Firstly the 'Begin' Standard Action does not get fired until you have clicked the 'Install' button on the last dialog of your install.
This is not clear as I would have expected the 'Begin' standard action to fire before the first dialog has appeared not the last.

Secondly use '-1' as the Execute Condition not 'true' as using 'true' doesn't work.

Return to “Common Problems”