Introducing Interactive JScript

Now available at
http://www.EmpowermentZone.com/ijs.zip

Interactive JScript
February 5, 2008
By Jamal Mazrui
Modified GPL License

I have wanted to build a JScript .NET interpreter.  I recently found an
article with code by Andrew Norris that got me started:

"A Simple JavaScript Command Line Interpreter for Windows in JScript.Net"
http://listeningtoreason.blogspot.com/
The original code has now been rewritten and extended considerably.

Interactive JScript (IJS) is a console mode environment that can
dynamically execute code in the JScript .NET language.  The source code is
in a single file, ijs.js.  a batch file, build.bat, calls the JScript
compiler, jsc.exe, which is distributed with the .NET 2.0 SDK.  The
resulting executable, ijs.exe, is about 40K in size.  It may be run from
any directory on a computer that has the .NET Framework 2.0 (or above)
installed.

IJS may be used to run or test code in either standard JScript or JScript
.NET.  For example, a .js file can define a sophisticated snippet that may
be invoked with the Alt+V command of the EdSharp editor, available at
http://www.EmpowermentZone.com/edsetup.exe

JScript code can also be evaluated by IronCOM, a COM server that provides
traditional Win32 applications with access to functionality of the .NET
Framework, available at
http://www.EmpowermentZone.com/comsetup.exe

The HomerKit library for JAWS
http://www.EmpowermentZone.com/kitsetup.exe
 includes a function called JSEval that wraps a JScript call via IronCOM,
thereby enabling JAWS scripts to make .NET calls for functionality not
available in the native scripting language.

IJS may also be helpful for programming in .NET languages other than
JScript.  Built in commands are defined for inquiring about available
methods, properties, and events via reflection.  You can explore an object
model, test expressions, save working code, and then convert it to the
syntax of another .NET language.

IJS works well with a screen reader, since new output to the console is
automatically read.  Periodically, the cls command is useful for clearing
the screen.

Below is the online documentation, available by entering the help command
in Interactive JScript.  Questions, comments, or code contributions are
welcome.

Jamal

Type a JScript statement, followed by Enter
(a closing semicolon is not needed)
Up arrow to repeat a command.

Most classes of the .NET Framework 2.0 may be used in expressions.
To ease typing, the following namespaces are imported
(so there classes may be referenced without a namespace prefix):
Microsoft.VisualBasic
System
System.Collections
System.Diagnostics
System.IO
System.Reflection
System.Text
System.Windows.Forms

In addition, the following built-in commands are available:
quit = end this program
cls = clear the screen
load = execute a JScript file
clipboard = execute JScript code on the clipboard
dos = execute a console-mode command and display its output
run = pass any statement to the Windows command interpreter (cmd.exe)
log FileName = log output to a file
log off = suspend logging
log on = continue logging
dir object = directory of all public members of object
constructors object = show constructors
events object = show events
fields object = show fields
methods object = show methods
properties object = show properties

__________
View the list's information and change your settings at 
http://www.freelists.org/list/programmingblind

Other related posts:

  • » Introducing Interactive JScript