I want to use Windows Script Host (WSH) from a VBScript called by a Wise install.
It seems that "Call VBScript from ..." does not have access to WSH.

The below VBScript fragment runs fine outside of Wise, but if called from the Wise install it fails.
If I step through with a debugger I get a "Variable is undefined 'WScript' " error
on the WScript.CreateObject call. (about line 9)

I am using Wise for Windows Installer 5.21 on WinXP SP2.
I am a very light Wise for Windows user and use it to deploy inhouse applications.

I have a hack/workaround that will work.
If I add my vbs file to the INSTALLDIR I can use "Execute Program from Destination"
to call wscript.exe/cscript.exe.
Setting the "working directory" to INSTALLDIR and
"EXE and command line" to "wscript.exe wise_test.vbs" works for this test script,
but is not the most intutive way to do it.

Am I doing something wrong or does Wise "hide" the WSH?


Thanks
Scott



Option Explicit
'On Error Resume Next

Dim objSysInfo
Dim NETcomp_name
Dim WshNetwork
Dim errnum

Set WshNetwork = WScript.CreateObject("WScript.Network")
MsgBox "Error num: " & Err.Number
NETcomp_name = WshNetwork.ComputerName & "," & WshNetwork.UserDomain
MsgBox "Error num: " & Err.Number
MsgBox "net name: " & NETcomp_name

MsgBox "CompName is: " & NETcomp_name
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Community Chosen Answer

2
You cant use the Wscript object because it is already kinda defined.

Remove the "wscript." references from your script and all will be fine.
Answered 03/03/2005 by: brenthunter2005
Fifth Degree Brown Belt

Please log in to comment
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Answers

0
ORIGINAL: brenthunter2005

You cant use the Wscript object because it is already kinda defined.

Remove the "wscript." references from your script and all will be fine.


Thanks,
That was easy.

Is this any of the help files? I looked and could not find anything.

Note to Wise Solutions Inc: Please add this to help file.

Thanks again

Scott
Answered 03/03/2005 by: srouse
Yellow Belt

Please log in to comment
0
I'm pretty sure I've seen this in the Windows Installer SDK documentation.
Answered 03/04/2005 by: brenthunter2005
Fifth Degree Brown Belt

Please log in to comment
Answer this question or Comment on this question for clarity