[solved] Writing Files from CustomAction .VBS File - Advanced Installer Community
a.guelle
Posts: 98
Joined: Tue May 19, 2015 2:23 pm

[solved] Writing Files from CustomAction .VBS File

Hi Folks,

The following VBScript works fine when running standalone:

Code: Select all

Set filesys = CreateObject("Scripting.FileSystemObject")
Set logFile = filesys.CreateTextFile("InstallVBS.log", True)
logFile.WriteLine "Hello World"
logFile.Close
But running it as a custom action via "Launch installed file" it does not write the file, nor throws any error. Why?
Last edited by a.guelle on Wed Jun 24, 2015 9:21 am, edited 1 time in total.
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Writing Files from CustomAction .VBS File

Hello,

I'm not sure why, but you can debug the custom action and see what really happens: How do I debug a .VBS custom action?

Here's a similar article with a sample that can help: How do I write text to a file?

If you want to log specific messages to the installer log file you can follow this article: How to write a specific event in the log?

However, please keep in mind that we don't recommend VBS custom actions unless absolutely necessary. You could also use our predefined Text Update feature for the same purpose.

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
a.guelle
Posts: 98
Joined: Tue May 19, 2015 2:23 pm

Re: Writing Files from CustomAction .VBS File

Ok It works. My Custom action Execution Stage was set to "Maintenance" instead of "Install".

Regarding this: How do I debug a .VBS custom action?

The Debugger installation fails on all my machines.
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Writing Files from CustomAction .VBS File

Are you running it as administrator?

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
a.guelle
Posts: 98
Joined: Tue May 19, 2015 2:23 pm

Re: Writing Files from CustomAction .VBS File

Yes, I do. The attached failure happens at the end of installing the debugger.

It says: "Error at creating the process <C:\Program Files(x86)\Microsoft Script Debugger\msscrdbg.exe /regserver>. Reason:" I could not find any hint to it via google.
Attachments
debuggerFailure.PNG
debuggerFailure.PNG (7.87 KiB) Viewed 6582 times
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Writing Files from CustomAction .VBS File

Hello,

That is strange, maybe it has something to do with the machine you're installing on. You can try on other machines and see if the behavior persists.
I was able to use it perfectly last time on a Windows 7 machine and I just performed an installation on my Windows 8.1 machine with no such error.

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

Return to “Common Problems”