Script Editor

Command: Tools > ImageLab Scripts > Script Editor

The script editor consists of the following three windows: (1) the script editor where you input your script code; (2) the status window which provides feedback during the execution of the script code; and (3) the console window which allows you to output information during the execution of the script.

The script editor is a flexible and powerful text editor which provides syntax highlighting and parameter completion support for the ImageLab script language. It can open up to eight scripts in parallel which are organized by tabsheets. The tabs show the filename of the corresponding script. Clicking the "Execute Script" button compiles and starts the currently visible script.

Parameter Completion

The editor supports parameter completion of known functions (i.e. all functions and procedures of the ILabPascal library). When typing the opening paranthesis of a parameter list of a library function the editor automatically displays the list of declared parameters of this function as a hint below the text cursor:

Thus you need not remember all the parameters of all available functions, which saves a lot of time during programming. Further, if you want to check the parameters of an already typed function call you can force the declared list of parameters to pop up by clicking into the parameter list and pressing Ctrl-M.

Code Proposal

The editor can provide you with a list of available ILabPascal functions which you can select from (i.e. all declarations, functions and procedures of the ILabPascal library). You can invoke the tool by pressing Ctrl-J:

The displayed list shows all functions which match the text at the cursor. The list of functions starts with all declarations whose names begin with the already written text, followed by all remaining functions and declarations which contain this text as a substring. In this way you can easily find a suitable function, even if you remember only a partial string of the full function name.

The first column of the code proposal window indicates the type of the variable or function, the second column shows the class the function is a member of and the third column shows the declaration. Move the selection bar by using the arrow keys and press either <ENTER> or Ctrl-<ENTER> to select and copy a particular declaration. Using <ENTER> (without the Ctrl key) will copy only the function name, pressing <ENTER> while holding the Ctrl key copies the entire declaration (which might come in handy if you want to copy the parameters to the var section of your code).

Key Mapping

In addition to the standard Windows key mapping, the editor supports a special key mapping which can be activated via the preferences dialog. This key mapping is a subset of the classic "WordStar" keymapping and allows to navigate through the code without using the mouse. Here is a list of shortcuts and their respective actions:

Key Action
F1 context sensitive help: select a keyword, a function name or a type declaration and press F1 to display the corresponding help page
F4 copy the selected text to the clipboard
F5, Ctrl+KT cut the selected text and copy it to the clipboard
F6, Ctrl+KC paste from the clipboard
F9 compile and run the script
Enter key insert a line break at the cursor, the cursor moves to the beginning of the new line
Alt+Backspace undo the last actions
Ctrl+A move the cursor back to the beginning of the current/previous word
Ctrl+C, PgDwn scroll down one page
Ctrl+D, Arrow right move the cursor one character to the right
Ctrl+E, Arrow up move the cursor one line up
Ctrl+F move the cursor forward to the beginning of the next word
Ctrl+G, Delete key delete the character at the right of the cursor
Ctrl+H, Backspace delete the character at the left of the cursor
Ctrl+I insert a smart tab (i.e. shift all characters right of the cursor to the next tab stop)
Ctrl+J invokes the code proposal tool (for details, see above)
Ctrl+K0..Ctrl+K9 set a bookmark at the current cursor position (bookmarks 0 to 9)
Ctrl+KI indent the current selection by one character
Ctrl+KU unindent the current selection by one character
Ctrl+L find next occurrence of search text
Ctrl+M displays the parameter completion tool (if appropriate)
Ctrl+N insert a line at the position of the cursor
Ctrl+Q0..Ctrl+Q9 jump to a bookmark (bookmarks 0 to 9)
Ctrl+QA enter new search and replace terms; press <ENTER> to start the search and replace process
Ctrl+QC move the cursor to the end of the scipt
Ctrl+QE move the cursor to the top of the page
Ctrl+QF enter a new search term; press <ENTER> to start the search and Ctrl+L to continue with the search
Ctrl+QD move the cursor to the beginning of the line
Ctrl+QR move the cursor to the beginning of the script
Ctrl+QS move the cursor to the end of the line
Ctrl+QX move the cursor to the bottom of the page
Ctrl+R, PgUp scroll up one page
Ctrl+S, Arrow left move the cursor one character left
Ctrl+T delete the text from the cursor to the next non+blank character
Ctrl+V toggle the insert/overwrite mode
Ctrl+W, Ctrl+Arrow up scroll the page one line up
Ctrl+X, Arrow down move the cursor one line down
Ctrl+Y delete the line of the cursor
Ctrl+Z, Ctrl+Arrow down scroll the page one line down

The console window is for debugging purposes only. Any output to the console window is invisible if the script is started outside the script editor. There are a few specific functions which control the output to the console: couts, couti, coutf and FuncMon.

Hint: You can define a template script in the preferences. This template script is automatically loaded when you click the "new script" button. It should already contain the most important structures of your scripts, thus wasting less time when creating a new script from scratch.

Last Update: 2018-Sep-17