Running Scripts from Menu

After you use a text editor to create a script file, and get connected with the host, you can run the script file from KoalaTerm menu:

Select "Run Script" from "Connection" menu, specify the file name, press OK, then the file will be loaded and executed in the context of current active terminal session.

Running Scripts by Keystroke

With KoalaTerm 3.0’s key mapping feature, you are able to map a key (or combined with modifier keys) to execute a script file or a few script lines.

Here are detailed instructions:

  1. Press "Settings" button or select "Settings" from "Connection" menu to bring up "KoalaTerm Settings" dialog;
  2. Click on tab "Keymap";
  3. Click on the key you want to map, and check proper modifiers (SHIFT, ALT, or CTRL);
  4. Select "Execute Script" from "Mapping" combo box if you want to execute just a few script lines, then a text box appear allowing you to type a few script lines;
  5. Or you can select "Run Script File" from "Mapping" combo box if you want to run a script file instead, you need to type the file name (including path also if not in the KoalaTerm directory);
  6. Click on "Set" button to confirm the mapping,
  7. You can continue to work with other keys, or press "OK" button to dismiss the settings dialog;
  8. You may want to save the key map along with other settings into a session file, click on "Save" button on the toolbar or select "Save" from "Connection" menu.

After all these done, you can then simply press the key (with modifiers you selected), the script will be executed in context of current active session.

Running Scripts by Button

KoalaTerm includes a button palette, which can be shown at the bottom of the terminal screen. If you don’t see it, check "Button Palette" from "View" menu.

With KoalaTerm 3.0, there are totally 32 buttons you can define as an additional way to do input or execute scripts.

Here are detailed instructions on how to use buttons to execute scripts:

  1. Press "Settings" button or select "Settings" from "Connection" menu to bring up the "KoalaTerm Settings" dialog;
  2. Click on tab "Buttons";
  3. A list box will show all buttons and their names (captions), click on the one you want to define;
  4. Input the name of the button in "Caption" text box;
  5. Select "Action" as "Execute Script" if you want to execute just a few lines of script, you need to type the lines;
  6. Select "Action" as "Run Script File" if you have got the file, you need to type the file name including path;
  7. Press "Set" button to confirm the definition;
  8. Go on with other buttons or press "OK" to dismiss the dialog;
  9. You may want to save the button definition along with other settings into a session file, click on "Save" button on the toolbar or select "Save" from "Connection" menu.

Running Scripts from Host

If you are a host programmer, you may found this way to run a KoalaTerm script very useful. Because KoalaScript has access to most of the terminal settings, it’s very convenient for host to send simple script lines over the connection and change many aspects of KoalaTerm simulation.

Hosts invoke KoalaScript by sending special sequences defined by KoalaTerm:

1. Activating a script file:

<ESC> P $ s <File Path> <ESC> \

Where "<File Path>" is the local path of the script file. If the file resides in the same directory as KoalaTerm does, you may specify only the file name.

Note: <ESC> is the ASCII 27 code. All spaces are added just for easier reading, you shouldn’t send spaces (except those in file name).

For example, the following sequence from host will run script "MyScript.kts" from the current KoalaTerm directory:

<ESC> P $ s MyScript.kts <ESC> \

2. Activating script commands Script-Commands:

<ESC> P $ t <Script Lines> <ESC> \

Where "<Script Lines>" is any KoalaScript lines. They may be separated by CR-LF or may not, doesn’t matter. See "KoalaScript Syntax" section for details.

Note: <ESC> is the ASCII 27 code. All spaces are added just for easier reading, you shouldn’t send spaces (except those in script lines).

For example: the following sequence from host will show a message box on the PC machine:

<ESC> P $ t sys.MessageBox("Hello!"); <ESC> \

Overview of KoalaScript Language

KoalaScript Object Reference

Go to Index Page