WScript.Sleep method in JScript

Date : Mon, 25 Jul 2005 18:02:35 +1000
To : xsi(at)Softimage.COM
From : Aloys Baillet <aloys.baillet(at)gmail.com>
Subject : WScript.Sleep method in JScript
Hi all,

I just wanted to execute a DOS command from a XSI script, and the JScript doc says we can use the following code:

var WshShell = new ActiveXObject("WScript.Shell");
var oExec = WshShell.Exec("calc");
while (oExec.Status == 0) {
     WScript.Sleep(100);
}

This bad script works well until it hits the WScript.Sleep call, as the global variable WScript doesn't seem to exist in the XSI scope.

However, the JScript doc says:
The WScript object is the root object of the Windows Script Host object model hierarchy. It never needs to be instantiated before invoking its properties and methods, and it is always available from any script file.
I would assume they forgot to mention that it was not available in XSI...

I also tried ActiveXObject("WScript.WScript") and ActiveXObject("WScript") just in case but to no avail.
Don't tell me to use Python, I know it would have been a lot easier;).
Thanks for any tip on this one!

Aloys

--
Aloys Baillet - XSI Technical Director
Character Dpt - Animal Logic
--

Search the XSI List archives here or use the advanced search form to search across mailing lists. Searching help is available.
This site supposedly brought to you by Benjamin Grosser and the Imaging Technology Group.