Frequently Asked Questions


PowerTerm can easily be setup to automate the login process, so that all steps necessary to login to a host computer can be activated via a script. Here are 2 sample login scripts, one for a modem connection and the other for a telnet connection:
send "atdt1-212-872-8181^M"
wait 30 for "CONNECT 9600"
send "^M"
wait 10 for "login:"
send "joseph^M"
wait 10 for "Password:"
send "cotten^M"

wait 10 for "login:"
send "wesley"
wait 10 for "Password:"
send "snipes"

In the above examples,
  • The send command sends the following string to the host.
  • The '^M' means the caret character followed by the letter 'M', and it represents the newline/Enter key.
  • The wait command causes the script to pause until the indicated string is received from the host.


Menus can be hidden easily from the Options menu, but they will automatically be restored upon later invocations. (NOTE: As of v5.2.4c, these are saved into the terminal setup file. So, this scripting is not necessary.)

To permanently remove them, you can place a line into a start-up script of the form:

  • menu hide
Additionally you can bring menus back under script control:
  • menu restore
To hide status bar, buttons and toolbar use the script commands:
set hide-status-bar on
set hide-buttons on
set hide-toolbar on
To restore status bar, buttons and toolbar say 'off' instead of 'on'.



The PowerPad is setup like a grid. You need to specify the row and column of the entry you want to program. The label of the button must be double-quoted and the function of the button goes after the "send".

Here are examples of programming them in a script:

  • pad 1 1 "ELM" {send elm^m}
  • pad 1 2 "DATE" {send date^m}
  • pad 1 3 "F3" {send <f3>}
  • pad 1 4 "F4" {send <f4>}

The softkeys are the labelled "F1", "F2" .. "F12" buttons at the bottom of the PowerTerm window.

Here are examples of programming them in a script:

  • func 1 "ELM" {send elm^m}
  • func 2 "DATE" {send date^m}
  • func 3 "F3" {send <f3>}
  • func 4 "F4" {send <f4>}


  • PowerTerm Script language uses many '{' and not many '('
  • NO: if ( $variable == "hello" )
    YES: if { $variable == "hello" }
  • Variable assignment does not use a '$'. Variable reference does.
  • NO: $var = $data
    YES: var = $data
  • assignment '=' must be surrounded by whitespace.
    (tests need not be surrounded by whitespace -- 'if {$var<=10}' is acceptable.)

    NO: i=1
    YES: i = 1

  • The '{' starting a block of statements MUST be on the same line as the 'if', 'for' ... statement.
  • YES: if { $data == 10 } {
    i = 45

    NO: if { $data == 10 }
    i = 45

  • incrementing is interesting...
  • use the 'expr' command which evaluates an expression, and the '[ ...]' facility which replaces itself with the result.

    Thus, i = [ expr $i + 1 ]
    or, use the 'incr' command which increments its argument (and because there is an assignment involved, no '$' is used.
    i = [ incr i ]
    .. or ..
    i = [incr i 3 ] # increment by 3

  • 'for' loop syntax is tricky:
  • as usual, there are 4 parts
    • initialization
    • test
    • increment
    • body statements
    ALL 4 PARTS ARE individually wrapped in '{...}'
    AND -- as indicated above -- the '{' beginning the body statements MUST be on the same line as the 3 earlier parts:
    NO: for (i=0; $i <10; $i++)
    var = 45

    YES: for {i = 0} {$i <10} { i="[incr" i]} {
    var = 45

  • Testing for Time Outs in 'wait' Here is an illustration of a script which uses a wait statement and an if to test the result:
  • str = [wait 10 for "hi there"]
    if {$str == "1"} {message "Hello to you"} else {message "no one home, $str"}

    For an unconditional wait, the 'wait' command can be used in this manner:

    wait 10 seconds # [always say 'seconds', even in 'wait 1 seconds']
  • 'wait'-ing for a string in a designated location The wait command can look for a string in a designated location, as in:
  • wait 10 for "F1" at 23 70

    This will wait 10 seconds for the string "F1" to appear in row 23, column 70.

  • Message and input boxes

    PowerTerm lets the script writer create pop-up boxes for 3 purposes: messages, text input and password-type input.

    • Message box.
      syntax: message text [title-text] [error|question|info]

      This will popup a box whose optional title is title-text, with the content of text, and with an optional icon suitable for error, question, or info. The user presses the OK button to continue.

    • Text input box.
      syntax: input-line text [title-text]

      This will popup a box which includes a text input area. The box has text of text, and an optional title of title-text. You can assign the input to a variable as in:

      data = [input-line "Enter Name" "My Title"]

    • password-type input box.
      syntax: input-password text [title-text]

      This command is similar to input-line, except that the text which the user inputs is not echoed back to the screen. Rather, '*' symbols are displayed.

  • Sending Hex Characters. This is done via '/xnnn'. example:
    key f3 do {send "\x301"}
  • Sending the Null '0' Character. This is done with the special character <null>. example: you need to send 'ABCZDEF' where 'Z' means the NULL '0' character. key f7 do {send "ABC<null>DEF"}
  • Sending the 'Enter' key: for Unix/VMS, '^M' represents the Enter/Return key. For IBM Mainframe/Midrange, <enter> is the way to do it.
  • To include a filename in a script, it is necessary to use 2 backslash characters to represent each backslash. example: to refer to the file \tmp\myfile.txt , say \\tmp\\myfile.txt
  • To access a PC environment variable within a script, use the 'GETENV' command. Here is an example:
  • data = [getenv TMP]
    if {$data == "bernie"} {message "yes"} else {message "no"}
  • To learn the current cursor position:
  • get col is the command for the column
    get row is the command for the row
  • To make a script 'pause' after it executes a PC program:
  • The problem is that lines like:
    result = [exec MYPROG.EXE]
    if {$result == 0} {return}
    message "The Program failed" ERROR

    Will not behave as expected because the script will execute the 'if {$result == 0} {return}' line immediately after starting MYPROG.EXE

    The solution is to have the script create a temp file, and to modify MYPROG.EXE to delete this file as its last operation.

    Then the script can be re-written as follows:

    open "\\temp\\temp.dat" w
    result = [exec MYPROG.EXE] #This will erase \temp\fred.dat when it completes
    while { 1 == 1 }

    wait 1 seconds
    isfile = [file exists "\\temp\\temp.dat"]
    if {$isfile == 0} {break}
    if {$result == 0} {return} ##the files does NOT exist
    message "The Program failed" ERROR
  • To use the proc script command:
  • The proc must be defined before it is used [remember, the script language is an interpreter.] Here is an example of usage of proc.
    proc say_hello x
    message $x

    say_hello Josephine

  • To exit PowerTerm under control of a script:
  • exit-emulator is the command


As of Version 5.0.1, any menu command which can be executed with the mouse can be run from within a script. (Menu Commands which require typing or which product a choice-list cannot be run from scripts.)

The script command is: activate-menu-item <command>

where <command> is one of the following list: