Emulating of WSH

To make it easy migrate already existing scripts written for 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:

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.Echo("Hi two"); // this should not be executed

After execution inside of HippoEDIT (Tools→Execute→wscript.js) you will get following text in 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    <DIR>          boost
14.08.2012  23:21    <DIR>          PDB
04.07.2012  00:22    <DIR>          Program Files
24.07.2012  23:00    <DIR>          Program Files (x86)
30.11.2011  01:30    <DIR>          Users
15.08.2012  03:10    <DIR>          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 Python scripts, be aware that you need to start all your WScript object calls by Application. Something like this: Application.WScript.Echo(“…”).