Script Editor
Script editor provides capability to:
Editing Features
VNCRobot editor provides editing
capabilities common in other text editors:
The editor saves all documents in the UTF-8 encoding. Note that though
you should be able to save a text file with any multibyte text, VNCRobot
cannot send characters out of ISO 8859-1 to VNC server. It means that
you can use national characters of most Western Europe languages
(German, Spanish, French, ...) but not Asian, Arabic, East Europian
etc. This is a limitation of the RFB protocol.
Command Wizard
VNCRobot editor has a new
command wizard which allows to select commands comfortably from a list
instead of typing them manually. The wizard can be activated by pressing
Ctrl+Enter in the editor. When invoked on an empty line, it displays a
list of available commands as is shown on the picture below. Commands
can be also activated by shortcut keys as is visible in the list below.

If you type a part of a command and open the wizard, it will match the
text against the list and display just applicable commands. If you e.g.
type 'ty' and press Ctrl+Enter, the wizard will display just the Type
and Typeline commands. This happens also when the wizard list is
displayed. If the text you typed is sufficient to identify the command,
it is inserted automatically into the script without displaying the
list. Try to type e.g. 'scr' and press Ctrl+Enter to insert a Screenshot
command into the script.
Pressing of Ctrl+Enter in a line which already contains a valid command
displays a list of supported command parameters. An example of the Connect
command parameters is shown on the picture below. If you select on in
the list, it will be inserted at the end of the line together with a
hint on what the parameter value should be like. Note that the wizard
does not validate the command in any way and it also doesn't check which
parameters the line already contains.

To modify the shortcut key (Ctrl+Enter) open the Preferences window and navigate to
Appearance & Accessibility -> Script Editor.
Syntax Validation
Script editor is capable of validating syntax of your test script. It
means that it checks whether your commands have correct syntax and
highlights the incorrect commands as is shown on the following picture.
If you place your mouse pointer above the invalid line, a tool tip
message with the error description should appear.

To configure color of the highlight open the Preferences
window and navigate to the Appearance->Script Editor tree node.
There are two points when validation is performed:
- Automatic Script Validation
- Pre-execution Validation
Automatic Validation
Whenever you modify a script, automatic validation is run after a
certain period of idle time. This might cause delays by large scripts.
To enable or disable this feature and configure the timeout open the Preferences window and navigate to the
Scripting tree node. This feature is by default on.
Pre-execution Validation
When you select Run or Run Selection to execute a script or its
part, a validation is performed. If there are errors, a warning message
gets displayed. There are options to execute the script anyway (Yes) and
to cancel the execution (No):
- If you select Yes, the script gets executed and all invalid
commands will be skipped.
- If you select No, a message pane with the list of errors gets
displayed at the bottom of the VNCRobot window. Select an error in the
message pane to navigate to the incorrect command line.
Breakpoints
Breakpoints let you stop execution of a script on certain lines. Once a
breakpoint is reached, the script gets paused and won't resume until you
deselect the Pause menu item or toolbar button.
To define a breakpoint, click onto the grey column on the left of a
script editor. The command line turns red and a red globe icon gets
displayed in the column. Eventually left click on the column to open the
breakpoint popup menu and select Add Breakpoint. You can remove
breakpoints in a similar way. The menu also provides a way to remove all
breakpoints in the editor. See the following picture which shows
activated popup menu for an already existing breakpoint.

To configure breakpoint color open the Preferences
window and navigate to the Appearance->Script Editor tree node.
Custom Popup Menus
Script editors provide a way to customize the editor popup menu. This
is often used by commads to provide quick access to command features,
help and configuration. To open a custom popup menu for a command right
click onto the command in the editor. The following picture shows a
custom popup menu for the Press command which includes:
- Display Supported Keys opens the Key
Browser window and lists all key names supported by this command,
- Configure Press opens the Preferences
window with the Press configuration,
- Help on Press opens the Help window with the Press command specification.

Popup menus may also contain dynamic items which are available only
under specific conditions. If you for example execute a Wait command or Waitfor together with the timeout
parameter, the menu contains an item labeled Continue which lets
you to bypass the timeout and resume the execution immediately.
The menu can be also activated by pressing Ctrl+Shift+Enter. To modify
this shortcut key open the Preferences
window and navigate to Appearance & Accessibility -> Script
Editor.
Execution Tracing
When a script is being executed, VNCRobot switches among editors and
scrolls the editor view to show the executed line. This feature enables
user to see the execution progress and currently executed command. The
following picture shows an example of an executed line.

This feature can be controlled by two flags:
- Open Included Files During Script Execution flag available
in Preferences under the Scripting tree
node. When you execute a script, it might run or include other scripts
using the Run or Include commands. This
flag defines whether VNCRobot should open these nested scripts in a new
editor when they get executed.
- Follow Execution Trace menu item and toolbar button. If the
item/button is selected, VNCRobot will switch among editors and scroll
the editor view to show the executed line. This flag is by default
switched on when you start a script execution. If you switch among
editor manually or start to edit a script during execution, this feature
gets automatically switched off.
To configure color of the executed line open the Preferences window and navigate to the
Appearance->Script Editor tree node.
Run Selection
If you want to run just a part of your script, you may select
(highlight) the lines you want to execute and select the Run Selection menu item to start
the execution. Note that the commands do not have to be highlighted
completely. Even if you select just a single character in the command,
VNCRobot executes the whole line. The following picture shows execution
of two selected command lines.

Note two important features of partial executions.
- First, even if you run just a few selected commands, all
procedures and variables contained in the script will be correctly
defined and they may be referenced in the selected commands.
- Second, execution of commands nested in a procedure is not
allowed. If you select part of a script which contains a procedure, all
commands in the procedure body will be skipped. You can however call
that procedure.