Can't access Session.Property - 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!

Spanners
Posts: 2
Joined: Thu Oct 25, 2007 11:22 am
Location: Manchester, England

Can't access Session.Property

Hi there
I'm a bit new to Advanced Installer and I'm having a big issue with an attached custom action vbscript. I can't get it to access Session.property values and I really need it to read Session.Property("APPDIR")
I'm trying to set up a scheduled task to run one of the installed files.
Here's my code

Code: Select all

const MON = 1
const TUE = 2
const WED = 4
const THU = 8
const FRI = 16
const SAT = 32
const SUN = 64

Dim strStartTime, boolRepeat, intWeekDay, intMonthDay, boolInteract, appDir, strCommand, objWMI, objNewTask

strStartTime = "********000000.000000+000"  ' 00:00 GMT
boolRepeat   = TRUE
intWeekDay   = MON OR TUE OR WED OR THU OR FRI OR SAT OR SUN 
intMonthDay  = "" 
boolInteract = FALSE

Function installTask()
		appDir = Session.Property("APPDIR")

		strCommand   = "java -jar" & appDir & "\irisReport.jar"

		set objWMI = GetObject("winmgmts:\\.")
		set objNewTask = objWMI.Get("Win32_ScheduledJob")
		intRC = objNewTask.Create(strCommand, strstartTime, boolRepeat, intWeekDay, intMonthDay, boolInteract, intJobID) 


End Function
If anyone could help I'd be really really grateful
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Hi,

Please note that Advanced Installer Enterprise offers support for creating scheduled tasks. You can read more about this feature here:
http://www.advancedinstaller.com/user-guide/tasks.html

If you are using a "Deferred" custom action then you will not be able to get or set properties, therefore Session.Property will not work.

For a deferred custom action the values of the properties will be specified in the "Action Data" field(in the custom action's "Properties" page) separated by a character that is appropriate in your case (for instance "|"):

Code: Select all

[PROP_1]|[PROP_2]|[PROP_3]
In the Custom Action the value of the CustomActionData Property will be retrieved and tokenized, thus retrieving the values of the initial Properties.

In your case you will use only the APPDIR property in the "Action Data" field. Also, please note that APPDIR ends by default with the "\" character.

If you need more details, let me know.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Spanners
Posts: 2
Joined: Thu Oct 25, 2007 11:22 am
Location: Manchester, England

Thanks very much for that, the CustomActionData property sorted me out :)
I've made an application that transfers files from several dozen clients to our main server so I've had to use a script to randomize the timing of the scheduled tasks so as not to kill our server. Otherwise I would have used the scheduled tasks function in AI.

Return to “Common Problems”