Z-Script Usage

A Z-Script module may be executed by a command in a console window, e.g.,

C:\zs>zs.exe modulename

That, of course, assumes Z-Script being installed in the C:\zs directory. A module name is the name of a script file (the extension may be omitted) and a script file name must have ".zs" extension. In the above example, there must be a script file named "modulename.zs" and saved in C:\zs, C:\zs\prog, C:\zs\cls, or C:\zs\lib. To execute a module in any other directories, the full path to the module is necessary, e.g.,

C:\zs>zs.exe d:\myscript\mymodule

If no module name is given, Z-Script tries to execute a module having the same name as the virtual machine program. Thus, by copying "zs.exe" to a different name, say my.exe, and creating a module with the same name, you can make zs.exe appears as different programs to end-users: they may just click my.exe to execute my.zs.

When you execute a module by a command line with options, e.g.,

C:\zs>zs.exe module opt1 name=John age=45 opt2

the program name, the module name, and the options are saved in a global hash array that may be accessed by using the primitive function getarg(key). That is

args(0); //returns ctalk.exe as string
args(1); //returns module as string
args(2); //returns opt1 as string
args(3); //returns name=john as string
args(4); //returns age=45 as string
args(5); //returns opt2 as string

When an option contains the "=" character, the parts before and after "=" are also saved as a key-value pair and the value may be accessed through the key, e.g.,

args("name"); // returns John as string

Note that no space should be used between "=" and the key or value because otherwise the DOS will pass them to the program as separate options. However you may use the double quote to include space in key or value:

C:\zs>zs.exe module opt1 "my name=John Kerry" age=45 opt2