hhale21
Posts: 26
Joined: Thu Apr 01, 2010 10:21 pm

custom action calling vbs script

Hello,
I have a custom action that calls a VBS script. The vbs gets session properties and calls a jscript.

The VBS script is being called, but call WshShell.Run(Session.Property("installhelper.js"),0,True) fails with error 80070002 (file not found)
The jscript file is in the install package and I create a custom action/property set formatted for the jscript file called 'installhelper.js'
Session.Property("installhelper.js") value is correct.

Is it possible that the installhelper.js is not in the expected location at time when the custom action for the vbs script is called?
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: custom action calling vbs script

Hi,

I think the problem is the private property. Can you please try using a public property and see if it works?

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
hhale21
Posts: 26
Joined: Thu Apr 01, 2010 10:21 pm

Re: custom action calling vbs script

Changing to a public property does not help. The return value of Session.Property("INSTALLHELPER.JS") is correct.
At what point have all the files been copied to their final destination?
I have tried adding the custom action to "InstallFinialize" Immediate execution, sync execution, ignore return code.
hhale21
Posts: 26
Joined: Thu Apr 01, 2010 10:21 pm

Re: custom action calling vbs script

Just to clarify what I am trying to do...
I have a template property file used by a service. I have to set values in the property file before the sevice is started.
The custom action calls a VBS script that modifies the property file based on values set via Session Properities.
The template file and the VBS have to be in their final install destination the custom action is executed.
So I need to know at what point all the files to be installed are in their final destination.
hhale21
Posts: 26
Joined: Thu Apr 01, 2010 10:21 pm

Re: custom action calling vbs script

I did some further investgation.
I added properties and the custom action to the InstallFiles standard action . The custom action is set to Immediate Action.
Looking the the log it shows that the project changes and script execution come before the files a actually copied thus the file not found error.

Action start 22:02:43: InstallFiles.
InstallFiles: File: Copying new files, Directory: , Size:

Action start 22:02:43: INSTALLHELPER.JS.
MSI (s) (F8:68) [22:02:43:750]: PROPERTY CHANGE: Adding INSTALLHELPER.JS property.

MSI (s) (F8:68) [22:02:43:890]: Doing action: installhelper.vbs
Action 22:02:43: installhelper.vbs.
Action start 22:02:43: installhelper.vbs.

Action 22:02:46: InstallFiles. Copying new files
MSI (s) (F8:68) [22:02:47:281]: Executing op: FileCopy(SourceName=instal~1.js|installhelper.js,SourceCabKey=installhelper.js,DestName=installhelper.js,Attributes=0,FileSize=2222,PerTick=32768,,VerifyMedia=1,,,,,CheckCRC=0,,,InstallMode=58982400,,,,,,,)

I tried moving the property and custom action to InstallServies and still the copy happens after the custom action. How do I change the action sequence???
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: custom action calling vbs script

Hello,

Please note that files are actually installed during InstallExecute standard action, since InstallFiles is a deferred action and all deferred actions are executed in InstallExecute.
Any operations that are to be done on files installed by your package should be done after this step.

Let me know if it helped.

Best regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
hhale21
Posts: 26
Joined: Thu Apr 01, 2010 10:21 pm

Re: custom action calling vbs script

Yes thanks, that worked. Although I had tried this before and it did not work.
Turns out that when the property is added in AI the formated text is quoted.

"[#installhelper.js]"

The following fails.

Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists(fileName) Then


Removing the quotes it all works.

Thanks.
hhale21
Posts: 26
Joined: Thu Apr 01, 2010 10:21 pm

Re: custom action calling vbs script

I have my custom actions in "InstallExecute" as suggested and this is working.
However I tried starting my service by setting "event on install -> start".
The problem is that the service start is occurring before the custom actions are run. Without the custom actions being run, the service is not configured and can't start.
How do I specify the custom actions have to be run before the service start?
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: custom action calling vbs script

Hi,

You can try moving the custom actions before InstallExecuteSequence -> StartServices in the "Custom Actions" page. This way they should run before the services are started.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
hhale21
Posts: 26
Joined: Thu Apr 01, 2010 10:21 pm

Re: custom action calling vbs script

That does not work, I have already tried that.
During the actual installation I see "starting services". My custom action scripts (that are not installed) fail because the files they do work on are not in their final destination. The [manufacturer] folder has not even been created yet.
After starting "starting services" and script failures I see "coping files".

My custom action/property source is set to "immediate execution" as are my custom actions that execute the scripts.
I tried deferred by the scripts don't execute before the "starting services"
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: custom action calling vbs script

Hi,
My custom action/property source is set to "immediate execution" as are my custom actions that execute the scripts.
Since you are launching files installed by your package, the custom actions should be deferred. Also, they should run without impersonation so they have full privileges. Try using the "Deferred with no impersonation" option for them.

Please note that in the default standard actions order files are installed before installing or starting services. Did you modify this order? If you didn't and the option I mentioned doesn't help, can you please send us the .AIP (project) file and a verbose log of the installation to support at advancedinstaller dot com so we can investigate them?

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
hhale21
Posts: 26
Joined: Thu Apr 01, 2010 10:21 pm

Re: custom action calling vbs script

I tried moving everything to "InstallServices" with custom action deferred with no impersonation, with no success.
The properties only permit immediate execution (all other choices grayed out)



I did not modify the order. Send the project.

Return to “Common Problems”