[Javascript] JScript and Windows Scripting Host

Mike Dougherty mdougherty at pbp.com
Tue May 29 15:26:10 CDT 2007


On 5/29/07, Tim Lewis <twlewis at softhome.net> wrote:
>
> I have a line of code for a WSH shell:
>
> var WshShell = WScript.CreateObject("WScript.Shell");
>
> I get the error message. 'WScript is undefined'
>
> I do not understand why.  What is more confusing to me is that I can run a
> VBScript with the line:
> Set objShell = CreateObject("Wscript.Shell")
> and this runs ok.
> If I understand WSH correctly, it is simply getting access to Windows
> functions.(please correct me if I am wrong in my thinking)
> It seems that if it failed in one language, it would fail in both.
>

try:  var WshShell = new ActiveXObject("WScript.Shell");

fyi - depending on how you have implemented your xmlhttp library, you might
be able to use them in WSH too (which is a really cool way to let your WSH
scripts talk to (reuse) your webservices)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20070529/d5c122e6/attachment.htm>


More information about the Javascript mailing list