Evaluating properties set by VB-script - 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!

darwin
Posts: 4
Joined: Wed Jun 27, 2007 10:50 am

Evaluating properties set by VB-script

I have problems using a custom action that checks if a certain process is running. In order to do that I use the following VB-Script (lp.vbs):

Function IsRunning()
strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcesses = objWMIService.ExecQuery ("Select * from Win32_Process Where Name = 'Foo.exe'")
If colProcesses.Count = 0 Then
IsSLRunning = False
Session.Property("FooRunning") = False
Else
IsSLRunning = True
Session.Property("FooRunning") = True
End If
End Function

This script is inserted as "UI Custom Action" with "Synchronous execution, ignore return code" and "Always Execute". Additionally I created a new Property "FooRunning" with Value "False" under "Install Parameters".

The purpose of this script is to show a certain dialogue (MyWarningDlg) if Foo.exe is running. I added new "Published Events" for the "Next" button of my Welcome-dialogue:

Event: DoAction
Argument: lp.vbs
Condition: AI_INSTALL

Event: NewDialog
Argument: FolderDlg
Condition: AI_INSTALL AND FooRunning = False

Event: NewDialog
Argument: MyWarningDlg
Condition: AI_INSTALL AND FooRunning = True

According to the Run Log my script is being executed without errors but neither the FolderDlg nor MyWarningDlg is shown. Is this the right way to set a user defined property by vbscript and to show dialogues according to its value?

many thxs in advance
gigi
Posts: 2103
Joined: Tue Apr 11, 2006 9:55 am
Contact: Website

Hi,

Only public properties (in upper cases) are set from UI to Execute sequence. So instead of FooRunning use FOORUNNING.

http://msdn2.microsoft.com/en-us/library/Aa370912.aspx

Regards,
Gigi
______________
Gheorghe Rada
Advanced Installer Team
http://www.advancedinstaller.com
darwin
Posts: 4
Joined: Wed Jun 27, 2007 10:50 am

Thanks for your quick reply.
I changed the property name according to your hint. Unfortunately the modification of a public property within a vbscript

e.g.

Session.Property("FOO") = "True"

seems to have no impact on a predefined public property (FOO is set to "False" on the "Install Parameter" page). To test the effect I set the text of a dialogue to [FOO]. It always shows "False". The Run Log shows that my Script has been invoked but I can find no hint that the FOO has been set.

Any ideas?

thx
darwin
Posts: 4
Joined: Wed Jun 27, 2007 10:50 am

I managed to find a solution by myself.

The solution is to omit the parentheses for the vbs function call both in the script and within the Custom Action Properties page.

Return to “Common Problems”