beautypg.com

AMD SimNow Simulator 4.4.4 User Manual

Page 168

background image

AMD Confidential

User Manual

September 12

h

, 2008

156

Chapter 12: Command API

use Win32::OLE;
use Win32::OLE::Variant;

$Win32::OLE::Warn = 3;

$cmd = Win32::OLE->new('SimNow.Command')

or die "Cannot open SimNow.Command\n";


$MyResponse = Variant(VT_BSTR | VT_BYREF, "");

do {

print "simnow> ";

$CmdLine = <>;

chomp($CmdLine);

if ($CmdLine)

{

if ($cmd->Exec($CmdLine, $MyResponse))

{

print "$MyResponse\n";

}

else

{

$cmd->GetLastError($MyResponse);

print "Cannot Exec: $MyResponse\n";

}

}

} while ($CmdLine);

print "\ndone\n";

Example 12-1: Perl Sample CMDAPI Source Code