Iain
Posts: 20
Joined: Tue Nov 03, 2009 12:13 pm

Temp VBS files

Hi All,

I have a number of custom actions using 'launch file or open url' which run functions in a vbscript. I also have the same under InstallFinalize inside the InstallExecuteSequence section.

The vbs file is added in the 'files and folders' section in the temp directory as a Temporary file.

My problem is that when I start the installer I get an error saying the file could not be read. On looking at the location I can see the temporary directory hasn't been created yet with the vbs file inside it.

I have then changed the file to be output into the appdir as a permanent file but I get the same error. If I copy the file into the location then start the install all is ok.

What I need in an ideal world is to be able to have the vbs file be a temporary file but to be in place before Advanced Installer attempts to read it, I'm guessing as the installer starts it reads through the custom actions and looks for the vbs file.

Any help would be great. Thanks
octavian.vasilovici
Posts: 51
Joined: Tue Jan 25, 2011 2:43 pm

Re: Temp VBS files

Hello,
I have a number of custom actions using 'launch file or open url' which run functions in a vbscript.
The solution to your problem is simple:
Instead of using "launch file or open url" to launch a vbscript, schedule the custom action as "Attached Custom Action". This article provides all the information regarding this type of custom action. In this case is important because it will act as a temporary file and you won't have to manually add the vbs file as temporary.

Regarding temporary files (which are not needed in your case):
... also have the same under InstallFinalize inside the InstallExecuteSequence section.
This article describes the "life-cycle" of temporary files: Any temporary file is extracted after CostFinalize standard action and is deleted during InstallFinalize standard action.

Thus, if you are trying to access a temporary file after InstallFinalize standard action it will fail because the file is no longer present. You should schedule any custom action you have before InstallFinalize standard action and after MigrateFeatureState. (It is not recommended to schedule any custom action that uses temporary files after the CostFinalize standard action because your custom action will be executed before extracting the temporary files and thus, will result in an error.)

Best Regards,
Octavian
_______________________________________________________________________________________________________________________________________________
Octavian Vasilovici
Advanced Installer Team
http://www.advancedinstaller.com/
Octavian Vasilovici - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Iain
Posts: 20
Joined: Tue Nov 03, 2009 12:13 pm

Re: Temp VBS files

Hi Octavian,

Thanks for your prompt response. I may, however have not mentioned everything correctly, the custom action is actually a UI Custom Action and is activated by a DoEvent from a button on one of my dialogs box.

I have tried changing them all to 'File Attached to Installation' but I still get the same error.
octavian.vasilovici
Posts: 51
Joined: Tue Jan 25, 2011 2:43 pm

Re: Temp VBS files

Hello,

Please try following these steps:

- Add the VBScript as a "New Attached Custom Action" in the "UI Custom Actions" section from Custom Actions Page.
- In the "Function Name" field write the name of the function from your VBScript.
- For your button add a new "DoAction" Published Event with the argument being the name of the custom action.

If the problem still appears can you please send us a verbose log and the project file (.AIP) to support at advancedinstaller dot com in order for us to investigate?

Best Regards,
Octavian
_______________________________________________________________________________________________________________________________________________
Octavian Vasilovici
Advanced Installer Team
http://www.advancedinstaller.com/
Octavian Vasilovici - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Iain
Posts: 20
Joined: Tue Nov 03, 2009 12:13 pm

Re: Temp VBS files

My mistake sorry, I was still having the vbs script as part of the project in the files and folders section. I have removed it from here and all is working as expected.

Sorry to waste your time.

Thanks

Return to “Common Problems”