Script Commands

The following script commands are in addition to those documented in versions of the Programmers Reference Manual produced prior to 2020. Each has a version specified, the first version of TinyTERM for Windows to include the feature.




Properties

Object properties act as variables. To set the value of a property, use the format te.Property = argument. For example:

te.CopyLineEnding = "\r\n";

To get the value of a property, use the property as the argument of an assignment or wherever you need the property’s value. For example:

var sPasteLineEnding = te.PasteLineEnding;

Each TE object includes the following properties:

Property Name Data Type Description Version

CDelay Integer Set number of milliseconds pause after each character transmitted. Only affects serial connections (RS232 and Modem).
Default = 0
4.65
CopyLineEnding String Set ending characters for lines of text copied from the TinyTERM screen. Any carriage return (CR, ASCII 13) or line feed (LF, ASCII 10) characters are stripped, and the value assigned here replaces it.
Default = LF
4.8.0
CrossHairs Boolean Enable cross-hair cursor in TN3270 or TN5250 emulation. This draws thin horizontal and vertical lines at the bottom left of the current cursor position, in the same color as the cursor.
Default = FALSE
4.8.6
PasteLineEnding String Set ending characters for lines of text pasted at the current cursor position. Behaves as CopyLineEnding otherwise.
Default = CRLF
4.8.0
PasteRemoveCR Boolean If set to TRUE, strips the carriage return character (ASCII 13) from the end of pasted lines.
Default = FALSE
4.8.0
PasteRemoveLF Boolean If set to TRUE, strips the line feed character (ASCII 10) from the end of pasted lines.
Default = FALSE
4.8.0




Builtin Function Reference

The CScript scripting language provides a library of functions that enable you to interact with the operating system and includes utility functions to make developing scripts for the TinyTERM emulator easier. This section describes new commands available and how to use these builtin functions.

String InputBox(sMessage,sTitle,sDefault)

Generates an input dialog with a text entry field, OK and Cancel buttons. The main window displays the contents of sMessage, and the title bar displays the contents of sTitle in the title bar and sMessage in the window. The text field fills with the contents of sDefault. Any of the three arguments may be an empty string. Returns the contents of the text field if the OK button is clicked, or a zero-length string if the Cancel button is clicked.
Added in TinyTERM version 4.8.4

item = InputBox("Enter UPC Code","Product Search","");

 

String InputBoxEx(sMessage,sTitle,sDefault,iMaxChar,iBoxType)

As InputBox above, but with additional options. iMaxChar is the maximum number of characters that will be accepted. Set to 0 (zero) to allow any number of characters to be entered. boxType is an integer and can be any of the following:

  0   OK button only
  1   OK and Cancel buttons
  2   Abort, Retry, Ignore
  3   Yes, No, Cancel
  4   Yes, No
  5   Retry, Cancel

The return value of InputBox is a string type that containes the entered text if the user pressed the OK button, or a blank string if they pressed Cancel.

For InputBoxEx box types 1 and 2 (OK or OK, Cancel) the return value is simply the entered string in the case the user pressed the OK button, or a blank string if they pressed Cancel.

For the remaining box types (2-5), the return value contains two fields, one for the text of the edit box and one for the value of the button they pressed. This is required to detect button presses other than OK and Cancel. To get at the two values, two helper functions are included, InputBoxText and InputBoxResult.
Added in TinyTERM version 4.8.4

userinput = InputBoxEx("Enter UPC Code","Product Search","",0,2);

 

Integer InputBoxResult(sInputBoxExReturn)

Returns a number associated with the button clicked when using the InputBoxEx function:

  1   OK
  2   Cancel
  3   Abort
  4   Retry
  5   Ignore
  6   Yes
  7   No

Added in TinyTERM version 4.8.4

button = InputBoxResult(userinput);

 

String InputBoxText(sInputBoxExReturn)

Returns the text entered in InputBoxEx.
Added in TinyTERM version 4.8.4

item = InputBoxText(userinput);

 

Null Script_Run(sScriptFile)

Executes either a .ttb VBA script or .cs TinyTERM script.
Added in TinyTERM version 4.9.0

Script_Run("C:/VBAscripts/ScreenGrab.ttb");



TE Object Controls

TE objects are accessed in scripting with the format te.ObjectName(parameters). For example, to clear the screen, the command is:

te.cls();

 

String CopySelectionWithOptions(iColumn,iRow,iWidth,iHeight,xOption)

In TN3270 or TN5250 connections, this function selects text for copy from the current screen and places it on the clipboard with a variety of options. iColumn is the starting column for the selection, iRow is the starting row, iWidth determines the number of characters across to copy, and iHeight the number of rows. Available xOption values are:

  0x01   Copy as plain text
  0x02   Copy selected text by field using SYLK
  0x04   Copy individual words as separate SYLK fields
  0x08   Include underscore character in copied text

Added in TinyTERM version 4.8.0
0x08 option added in TinyTERM version 4.12.1

te.CopySelectionWithOptions(2,3,10,1,0x02);

 

Integer GetCaretCol()

Returns the one-based column of the current cursor position.
Added in TinyTERM version 4.8.0

xLoc = te.GetCaretCol();

 

Integer GetCaretRow()

Returns the one-based row of the current cursor position.
Added in TinyTERM version 4.8.0

yLoc = te.GetCaretRow();

 

Integer InterruptProcess()

Sends a telnet interrupt process command, hex FF F4.
Added in TinyTERM version 4.10.1

te.InterruptProcess();

 

null MacroPlay(sMacroFile)

Plays back an IBM .ttmacro macro file.
Added in TinyTERM version 4.8.6

te.MacroPlay("login.ttmacro");

 

null Paste(xFormat)

In TN3270 or TN5250 connections, this function determines how data is pasted into the current screen. Available values are:

  0x00   Paste characters as if typed from the keyboard (default)
  0x01   Continue to paste existing data as long as input fields permit
  0x02   Stop paste at end of current field
  0x04   Newline advances to next field and continues paste. Overrides 0x02 if set
  0x08   Allow cursor to wrap to top of screen to continue paste
  0x10   SYLK paste for data copied from applications such as Microsoft Excel
  0x20   Do not erase contents of fields getting pasted into, before writing new data
  0x40   Do not convert each tab character (ASCII 9) to four spaces (ASCII 32)

These values are additive; for example, 0x03 combines 0x02 and 0x01 behaviors.
Additional values added in TinyTERM version 4.8.0 and 4.8.6

te.Paste(0x05);

 

Integer SelectedColumn()

Returns the one-based column of the position the mouse was clicked on. Must be used within a mouse event to recognize the mouse click properly.
Added in TinyTERM version 4.8.4

xLoc = te.SelectedColumn();

 

Integer SelectedRow()

Returns the one-based row of the position the mouse was clicked on. Must be used within a mouse event to recognize the mouse click properly.
Added in TinyTERM version 4.8.4

yLoc = te.SelectedRow();

 

null SetCursorPos(iXloc,iYloc)

In TN3270 or TN5250 connections, this function moves the cursor to the specified position. The first argument is the row, and the second is the column. The top left corner of the emulation screen is position 1,1.
Added in TinyTERM version 4.8.0

te.SetCursorPos(22,4);

 

null SetIBMChars(sDBCSopen,sDBCSclose,sBlankFill)

In TN3270 or TN5250 connections, this function changes certain IBM identifier characters. The first argument is the opening delimiter for DBCS characters. The second argument is the closing delimiter for DBCS characters. The third argument is the fill character for blanked fields, such as passwords.
Added in TinyTERM version 4.8.2

te.SetIBMChars(" "," ","*");

 

Integer WaitAt(sString,iXloc,iYloc,iTimeout)

Wait iTimeout seconds for string sString to be received from the commline at column iXloc and row iYloc, or for the user to cancel by typing Ctrl-C. If iTimeout is set to 0, Wait will not time out. Returns 0 on success, -1 for a timeout, and -2 for a user cancel.
Added in TinyTERM version 4.8.1

success = te.WaitAt("word:",7,7,5);

Back to TinyTERM Plus for Windows documentation index