EZL Documentation Home

EZScripts

Writing and editing scripts is easy with the EZScript Editor. The editor is display with an example script.

An EZScript is simply a list of commands to be executed as a batch within EZL. EZScripts can be created using any text editor of your choice, but be sure to save them with a .ezs extensions. This extension informs EZL to treat the file as an EZScript instead of as a regular data file.

To execute an EZScript, simply type the name of the script (with or without the .ezs extension) into the Command Window and press enter. If the script is located within the current workspace path or the EZScript search path, you do not need to fully qualify the path of the script. For example, in this case you could just type "myscript.ezs" instead of "c:\ezl\scripts\myscript.ezs". EZL will first search the current workspace path for a match and then, if not found, will search the EZScript search path.

• EZScript Editor

For convenience, EZL comes with a built-in editor, specifically tailored to writing EZLScripts.

The EZScript Editor can be opened either from the Tools menu

EZScript Editor open 1

or by right-clicking on an EZScript file within the Directory Browser and clicking "Edit"

EZScript Editor open 2

When the editor is first opened, a tab will automatically be created containing either a blank script (when opened through the Tools menu) or your pre-existing script (when opened by right-clicking on a Directory Browser item).

New scripts can be created by clicking New from within the File menu, by pressing Ctrl+N on the keyboard, or by clicking the New script button located on the right-side of the editor.

Open existing scripts by clicking Open from the within the File menu, by pressing Ctrl+O on the keyboard, or by clicking the Open script button on the editor's toolbar. When opening existing scripts a new tab will be created automatically, unless the script within the current tab is empty (in which case, the current tab is reused).

Save your scripts by clicking Save from the within the File menu, by pressing Ctrl+S on the keyboard, or by clicking the Save script button on the editor's toolbar.

If the current script already has a file name associated with it, you can use Save As... from the File menu to save it under a different name.

Close scripts by clicking Close Script from within the File menu, by pressing Ctrl+K on the keyboard, or by clicking the Close script button located on the right-side of the editor.

To begin a comment line within a script, or to comment or uncomment the current line, use the Script comment and Script uncomment toolbar buttons, respectively. Or use their keyboard shortcuts: Ctrl+R and Ctrl+T (these shortcut keys were adopted from Matlab).

Finally, the toolbar's run button Script run allows you to immediately execute the script. While, in general, EZScripts are saved to the hard drive so they can later be executed from the Command Window, this button provides you with a convenient way to run/test your scripts. It works on unnamed scripts (ie. unsaved) as well as name scripts. Note, however, that if your script uses input arguments, you may receive errors, as arguments can only be provided to the script via the Command Window or when running EZL from the Windows' command prompt (using the -script <script_name> option).

• EZScript Basic Syntax

In its most basic form, an EZScript is simply a list of EZL commands. When executed, EZL sends the script line-by-line to the Command Window. EZScripts can call other EZScripts. There are no restrictions on the depth of embedded scripts.

Line Continuation

Typically, each line of a script represents a full command. However, sometimes you may have a particularly long command, and for aesthetics would like to continue the command to the next line.

The line-continuation character set "..." is used for this purpose. This is illustrated in the script shown in the figure at the top of the page, where the "ezl" command is continued over five lines.

Comment Lines

Lines may be commented-out with the "-->" character set. Any line which begins with "-->" will be ignored by EZL's command parser and therefore not sent to the Command Window. Comment lines are used only by you, typically for documentation or for manually toggling commands on or off within a script. Some notes about comments:

  • Comments must be on their own separate line.
  • Comment lines cannot be continued to a new line with the continuation set "...". This is by design to allow commenting items within multi-line commands. For instance, in the example script above, the line "-header ..." can be commented out, without affecting the subsequent lines ("-xlbl Time ...", "-ylbl Signal ...", etc.)
  • Comment lines will appear green in the EZScript Editor.

• EZScript Input Arguments

One powerful aspect of EZScripts is the ability to write generic scripts using input arguments. When run through the Command Window, you may pass input arguments to an EZScript, which will then be embedded into the script text. Argument designators are specified in an EZScript using the syntax "%d", where d is a number specifying which argument to use. For example:

EZScript input arguments

Suppose we have data files for several GPS receivers: receiver1.dat, receiver2.dat, receiver3.dat, etc... The EZScript shown above allows us to pass in the receiver number and a tailored x-label.

Running the example script with this command (via the Command Window)

> acq.ezs 3 "GPS Satellites"

replaces all instances of %1 with 3, and %2 with "GPS Satellites". So, the input file becomes receiver3.dat, the title becomes "Acquisition of Receiver 3", and the x-label becomes "GPS Satellites".

Notice that the first argument (%1) was used twice in the script: once as a portion of the input data file "receiver%1.dat", and again as a portion of the title "Acquisition of Receiver %1". Arguments may be reused as many times as desired, and there is no limit to the number of input arguments (eg. %1, %2, %3, %4...)

Running the above script, might produce the example plot shown below.

EZScript example plot

If there are more input arguments than there are designators in the script, the extra arguments are ignored. For example, if our command was

> acq.ezs 3 "GPS Satellites" "Extra Argument"

the final argument "Extra Argument" would simply be ignored, since the script has no %3 designator.

However, if a script designator specifies an argument which does not exist, an error is produced. For example, if our command were

> acq.ezs 3

an error would be displayed to indicate that a parameter is missing (in this case, parameter %2).

• Helpful Tips