WshScriptExec Object
Provides status information about a script run with Exec along with access to the StdIn, StdOut, and StdErr streams.
The description says "The WshScriptExec object is returned by the Exec method of the WshShell object. The Exec method returns the WshScriptExec object either once the script or program has finished executing, or before the script or program begins executing."
What determines whether WshScriptExec is returned immediately or after the program has finished executing? I'd prefer asynchronous operation, which is implied by the code example with its sleep loop, but am experiencing synchronous.
If you add the .Net frame work to your Environment variable PATH you can then use. "jsc yourCode.js" which will compile it into an .exe. "jsc /?" will give your the man page for your version of JScript. If you run the code this way you will have Synchronous runs like the code above.
problems and solutions with this way of doing JScript:
Because you are no longer using the WScript or CScript objects to run you code you will loss the reference to "WScript.sleep(int);". I'm sure there's a .Net way to sleep but i can't find it. I created a work around by using "WshShell.run(app,windowtype, Synchronous)" to get around the lack of "WScript.sleep(int);" with a call like this, "WshShellObj.run("Sleep.exe -m 100", 6 , true);". Sleep.exe is from Windows resource tool kit. Also when compiling JScript to create the "WshShellObj" you will need to do this "var WshShellObj = new ActiveXObject("WScript.Shell");"
Hope this helps.
- 8/13/2010
- Zeratul the Dark Templar
- 8/13/2010
- Zeratul the Dark Templar
The description says "The WshScriptExec object is returned by the Exec method of the WshShell object. The Exec method returns the WshScriptExec object either once the script or program has finished executing, or before the script or program begins executing."
What determines whether WshScriptExec is returned immediately or after the program has finished executing? I'd prefer asynchronous operation, which is implied by the code example with its sleep loop, but am experiencing synchronous.
- 4/15/2010
- StevenHB13