====== Emulating of WSH ======
To make it easy migrate already existing scripts written for [[http://msdn.microsoft.com/en-us/library/9bbdkx3k(v=vs.84)|WSH]] to HippoEDIT scripts, or just simplify your learning curve with HippoEDIT scripting, HippoEDIT provides limited emulation of WSH objects and methods.\\
Explicitly there are following objects:
* **WScript** (IWScript),
* **TextStream** (IWshTextStream) and
* **Arguments** (IWshArguments)
* rest of objects can be created with help of //WScript.CreateObject//
Following methods are not supported:
* [[http://msdn.microsoft.com/en-us/library/ccxe1xe6(v=VS.84).aspx|WScript.ConnectObject]]
* [[http://msdn.microsoft.com/en-us/library/2d26y0c1(v=vs.84).aspx|WScript.DisconnectObject]]
* [[http://msdn.microsoft.com/en-us/library/dc1y0x0h(v=vs.84)|WScript.Arguments.ShowUsage]]
Here is simple example that demonstrate emulation:
var WshShell = WScript.CreateObject("WScript.Shell");
var WshExec = WshShell.Exec("cmd /c dir c:\\");
while (!WshExec.StdOut.AtEndOfStream)
WScript.Echo( WshExec.StdOut.ReadLine() );
WScript.Echo(WScript.Fullname + ", v:" + WScript.BuildVersion);
WScript.Echo("Hi one");
WScript.Quit();
WScript.Echo("Hi two"); // this should not be executed
After execution inside of HippoEDIT (//Tools->Execute->wscript.js//) you will get following text in [[plugins:output-window|Output Window]]:
Volume in drive C is SYSTEM\\
Volume Serial Number is 4487-D7CB\\
Directory of c:\
22.05.2011 00:44 1 024 .rnd
02.07.2012 08:29 boost
14.08.2012 23:21 PDB
04.07.2012 00:22 Program Files
24.07.2012 23:00 Program Files (x86)
30.11.2011 01:30 Users
15.08.2012 03:10 Windows
1 File(s) 1 024 bytes
6 Dir(s) 31 271 751 680 bytes free
C:\Program Files\HippoEDIT\HippoEdit.exe, v:150775
Hi one
If you want to use WSH emulation for [[scripting:python|Python scripts]], be aware that you need to start all your WScript object calls by //Application//. Something like this: //Application.WScript.Echo("...")//.