Perl
From iMacros
The iMacros Scripting Interface can be used from any programming or script language that can use the standard Windows COM object interfaces. The following example shows you how to call this interface from Perl. The script initializes the Scripting Interface and calls a macro with name "Yahoo". It also contains a subroutine that prints out messages returned by the iMacros Scripting Interface.
Begin new script
#------------------------------------------------------------------------
use Win32::OLE;
$b = Win32::OLE->new('imacros') or die "Iopus could not be started by Win32:OLE\n";
$b->{Visible} = 1;
$b->iimInit();
#Calling an IOPUS macro ie;yahoo.iim . Write a Simple iim script to goto www.yahoo.com
my $macro = "yahoo";
$b->iimPlay($macro);
&err ();
$b->iimExit();
########################################################################
# Get the last message reported from Iopus upon macro completion status#
########################################################################
sub err {
$lastMessage = $b->iimGetLastMessage();
if ($lastMessage =~ /Macro completed/) {
print("Success <$macro> $lastMessage\n");
#write a logger here for Success $lastMessage
}
else{
print("Failure <$macro> $lastMessage\n");
#write a logger here for Failure $lastMessage
}
}
#___________________________________________________________________________
_
End New Script
This tutorial was provided by Mark Swank of Nokia Internet Communications.
