Open as PDF
User Manual November 21
Chapter 12: Command API 159
12 Command API
The CMDAPI (cmdapi.dll) gives Windows users a way to script the simulator using any
scripting language that can interface with the Microsoft Component Object Model
(COM). It gives you the opportunity to create scripts that instantiate a simulator object.
You can use this instantiated object to execute any of the SimNow™ automation
commands, see Section A.7, “Automation Commands”, on page 227.
CMDAPI is installed and registered whenever a SimNow release package has been
After instantiating a SimNow.Command object, you can use the following methods to
execute automation commands, and retrieve status.
The Exec method executes the automation command that arg1 contains.
bool Exec(arg1, arg2);
A string that contains the SimNow automation command to execute. For
example, "debug:0.execcmd t".
An input string buffer in which SimNow is to place the response from the
command in arg1.
Returns true if command completed successfully; otherwise it returns false.
The GetLastError method returns the last error code. If Exec returns false
you can call GetLastError to retrieve the error code.
An input string buffer, in which SimNow will place the last error that was
recorded from the automation interface.
The Perl code in Example 12-1 shows how to instantiate a SimNow.Command object and
how to interact with the SimNow™ CMDAPI interface.