Links

Categories

Tags

JILRun Runtime Environment for Windows

An automation tool for Windows.

The JILRun Runtime Environment is a console application that embeds the JewelScript language to allow users to program automated tasks. It contains a number of useful native classes statically linked to the executable.

Among the more interesting native types are:

Because the program is entirely self-sufficient and has no dependencies to any DLLs, the runtime environment is easily portable to any computer or can be run from removable storage devices like USB sticks. No clunky JRE or bloated .NET runtime to install, just one tiny EXE file only 300 KB in size.

The program runs on all Windows versions from XP to Win 8. It’s main purpose is enabling users to quickly and easily write automation tasks for the Windows shell.

Installation

Just download and extract the archive anywhere you wish. There is no specific installation procedure required to run it. In order to run scripts, you’ll need a command-line prompt of course. Or you could make a shortcut or batch file to run scripts from the desktop environment. These are unfortunately still the only options for Windows computers.

If you wish, you can associate the script file extension “.jc” with the executable. That way you can run scripts from the desktop by double-clicking them. However, you would not be able to pass additional parameters to the script, which is often required to program useful scripts.

A workaround is to create a shortcut to the JILRun executable and edit it’s properties. In the command-line field, you would add the full pathname of the script file to execute. This will allow you to start the script with any additional files you drag onto the shortcut as parameters. If your script application consists of multiple files that are imported by a main file, make sure you also set the working-directory correctly in your shortcut.

I recommend using LaunchPad to create shortcuts to your scripts, which will make starting script applets from the desktop much easier.

The Library folder

The Library folder is meant to reside next to the JILRun executable. It contains shared classes that should be available to all scripts.

If you wish, you can change the location of the Library folder. There are two ways to do this. First, by adding the parameter -i “path” to the command-line of the JILRun executable. The second option is to define the environment variable JIL_LIBRARY_PATH to the location of the Library folder.

Command-Line Options

The command-line of the jilrun.exe application has the following format:

jilrun [options] file [param param ...]
file JewelScript source file to compile and run
param Optional parameters to be passed to the script’s main() function

The simplest usage would be:

jilrun myScript.jc
jilrun myScript.jc myScriptParameter1

The following options are available:

-bind path Generate C++ binding code in the specified directory. This may be useful to generate bindings for your own C++ classes.
-doc path Does nothing in release builds of the program.
-e string Specify script file extension to assume (default: jc)
-i path Define import path. This allows you to move the Library folder to a different location. By default, the folder is expected to reside next to the jilrun.exe application.
-k Keep compiler. Do not free compiler object before running the script.
-l Output virtual assembler listing of compiled code. This may be interesting, if you are a tech-geek and want to see the actual byte-code the compiler generates.
-log Enables file logging. All output is written to “jilrun.log” in the current working directory.
-o string Specify compiler options (enclose in quotes). The options have the same format as the JewelScript option statement (see language reference).
-rb Read the file as a compiled binary program. Loading a script application from byte-code is faster, since no code needs to be compiled. This may be beneficial with very large projects.
-v Output version info.
-w Wait for enter.
-wb file Write a compiled binary program using the given filename. Saving compiled byte-code to disk for use with the -rb option can speed up starting the program, if compiling takes a long time.
-x Exit without running the script. This is useful if you just want to syntax-check the script file and get error information.
-xml file Export type information to the specified XML file.

The main() Function

Your script must define a main() function. This will be the entry-point that is called by JILRun to start your script. The function is declared like this:

function string main(const string[] args);

About the example script

I have included an example script application with the release. See this post for detailed information about that.

Resources

Download jilrun-0.7.2.22-win32.zip – built against JILRuntime 1.3.4.26

Class documentation
Built-in class documentation
JewelScript language reference
Synthax highlighters for Notepad++, Textpad 4