AMD 4.4.5 Switch User Manual


 
AMD Confidential
User Manual November 21
st
, 2008
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
installed successfully.
After instantiating a SimNow.Command object, you can use the following methods to
execute automation commands, and retrieve status.
Exec
The Exec method executes the automation command that arg1 contains.
bool Exec(arg1, arg2);
Parameters
arg1
A string that contains the SimNow automation command to execute. For
example, "debug:0.execcmd t".
arg2
An input string buffer in which SimNow is to place the response from the
command in arg1.
Return Value
Returns true if command completed successfully; otherwise it returns false.
GetLastError
The GetLastError method returns the last error code. If Exec returns false
you can call GetLastError to retrieve the error code.
void GetLastError(arg1);
Parameters
arg1
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.
#!perl -w