Environment Commands
Macros use environment commands to write data to the macro output, to determine
a value, or to call other commands. Table 51 on page 475 describes the environment
commands that are currently supported.
Table 51: Environment Commands
DescriptionCommand
Causes the macro to delay further execution for the number
of seconds specified by delay
env.delay(int delay)
Prompts the user with a question mark (?) and waits for a
response
env.getLine
Prompts the user with the value of prompt-string and waits
for a response
env.getLine(string prompt-string)
Prompts the user with a question mark (?), waits for a
response, and echoes the response with an asterisk (*) for
each character entered by the user
env.getLineMasked
Prompts the user with the value of prompt-string, waits for a
response, and echoes the response with an asterisk (*) for
each character entered by the user
env.getLineMasked(string
prompt-string)
Returns the number of arguments passed to the macroenv.argc
Returns the value of the nth argument, such that 1 <= n <=
env.argc
The returned value is a string, not a number; if you want to
use this value for a subsequent numeric operation, you must
first convert it to a number with the env.atoi(string) command
env.argv(n)
Returns the name of the macroenv.argv(0)
Converts the specified string to a numeric valueenv.atoi(string)
Converts input values to integersenv.atoi(env.argv(n))
Sets parameters within a macro for display through the
macroData log at the NOTICE severity level following the
completion of the macro
env.setResult
Returns the command string that triggered a macro errorenv.getErrorCommand
Returns the reason for a triggered errorenv.getErrorStatus
Starts the capture of command outputenv.startCommandResults
Stops the capture of command outputenv.stopCommandResults
Returns one line of output from the capture bufferenv.getResults
Writing Macros â– 475
Chapter 8: Writing CLI Macros