Simple examples of using VBS & JS attached scripts - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

davidesharpe
Posts: 56
Joined: Fri Jul 01, 2011 4:56 am

Simple examples of using VBS & JS attached scripts

Hi,

I have managed to create simple inline vbscript & jscript custom actions, and now I'm trying to create more complex and larger scripts, and so i'm attempting to use the attached script method and writing the scripts in separate .vbs or .js files. However I just keep getting a "There is a problem with this Windows Installer package. A script required for this install to complete could not be run. Contact your support personnel or package vendor"

What I need is some straight forward simple examples of .vbs & .js attached scripts and EXACTLY how they are set up in Advanced Installer, particularly the format of the Function Name etc, I cant find a tutorial on this .

my latest attemp in vbscript was this.

Private Sub DisplayBox()
Dim iInt as Integer
End Sub

and the Function Name was "DisplayBox()" ( I also tried "DisplayBox" )

I'd also like to see jscript examples

Thanks
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Simple examples of using VBS & JS attached scripts

Hello,

Here is a link to our user guide that explains when a VBScript custom action could fail.

The function format should be something like:

Code: Select all

Function YourFunction()
End Function
Also, in VBScript, installer public properties can be accessed like this:

Code: Select all

' read
value = Session.Property("PROPERTY_NAME")

' write
Session.Property("PROPERTY_NAME") = value
Here is an article with a VBScript sample functionality among others in the user guide. Unfortunately we don't have any JScript samples, but you can search the Internet or Microsoft support resources. This link is a good starting point.
and the Function Name was "DisplayBox()" ( I also tried "DisplayBox" )
The function name should be without the brackets.

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”