Skip to main content

Commands and Comments

Commands

A SenseTalk script is a sequence of commands, also known as statements, that contain your instructions. Type each statement on a separate line, in the form of an imperative command that begins with a verb. In this manual, you will see the term "statement" used in example syntax.

When running or executing a script, SenseTalk performs the actions described by each statement in turn, from the first to the last, unless directed to do otherwise (such as by the flow control constructs as described in Flow Control). SenseTalk ignores blank lines. For supported commands and functions see Commands and Functions.

Parameters are values that are passed to commands or functions, that can then be used by the command or function to accomplish a desired action. The below examples show commands being called, with a number of parameters being passed to those commands. For more on parameters, see Parameters and Results.

Example:

put "Hello, World!" into greeting
wait 3 seconds
put "eggPlant says: " & greeting

Example:

add 5 to total

Example:

Click "HomeFolder"
WaitFor 8.0, "HomeHeader"
Typetext AltKey,F4

Continuing Long Statements on the Following Line

A longer than usual SenseTalk statement may be continued to the next line by entering a \ (backslash) character at the end of a line:

Example:

put "Hello! This is a simple contrived example " \
& "to show how a long statement " \
& "may be continued across several lines."

Example:

log each item of ["house","mouse","louse","pizza","grouse"] \
whose length is 5 and which contains "ouse"

Comments

Comments are non-executing portions of your code that may be introduced into a script at any point to provide notes to the reader or developer of the script. Comments begin with -- (two dashes), (an em-dash), // (two slashes), or # (a pound sign) and continue from there to the end of the line.

Block comments, enclosed in (* and *) allow you to insert comments into the middle of a line, or to span multiple lines. Block comments can be nested.

Example:

(*Script: LoginTestID: 2390823Author(s): Bob, Cindy, JanetLast Updated: 5/25/2016*)

Example:

log each item of ["house","mouse","louse","pizza","grouse"]\
(*whose length is 5 and*) which contains "ouse"

Example:

(*
log each item of ["house","mouse","louse","pizza","grouse"]\
(*whose length is 5 and*) which contains "ouse"
*)

Example:

-- make the user think the computer is thinking hard!

Example:

if imageFound("Popup") then
LogWarning "undesired popup appeared" -- this relates to bug #2021
end if

Example:

// let's change the greeting to French

Example:

#Welcome
#to
#Jurassic
#Park