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!

Guest

Using Wscript Property in Custom Action

Hi,

I have some difficult using VBscript in a custom action:

My CA is in the InstallInitialize sequence, is Synchronous, check return and immediate.
Here is a piece of the code:


ocmfile = "\\archives\diffusion\MGE_NMP406\InstallOCM.txt"
commande = "sysocmgr.exe /i:%windir%\inf\sysoc.inf /u:" & ocmfile & " /q /r"

Set proc = WshShell.exec(commande)
Do While proc.Status = 0
Wscript.Sleep 1
Loop
InstallIIS = IDOK
Exit Function


The error in the log is Erreur d'exécution Microsoft VBScript: Objet requis: 'Wscript' Line 100, Column 5

I read this topic
http://www.advancedinstaller.com/forums ... ht=wscript
but I wonder how can I use this Wscript property?
Cata
Posts: 638
Joined: Thu Apr 10, 2003 7:37 am
Contact: Website

A sample VBScript code that works for me and that instantiates a Wscript object:

set myScript = CreateObject("WScript.Shell")
commande = "NOTEPAD.EXE"
myScript.exec(commande)
Catalin Rotaru - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Guest

your sample VBScript code works fine and it's similar to mine

the only difference is that I instantiate the wshshell.exec property in an object and I loop while his status property isn't <> 0

That's where I've got a problem because I must access to a wscript property and I can't....

I wonder what to do
Cata
Posts: 638
Joined: Thu Apr 10, 2003 7:37 am
Contact: Website

I can't debug VBScript, I'm really no expert. Maybe somebody else?
Catalin Rotaru - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
cpsarros

You are missing these lines:

Dim WshShell
Set WshShell = CreateObject("WScript.Shell")

Return to “Common Problems”