GetCommandList ---- how to use this in perlscript

Posted by Databug on Mon 08 Jan 2007 10:49 AM — 3 posts, 21,144 views.

#0
I'm having trouble using this function, the example given in the helpfile is confusing.

All I want it to do is something simple. Just make a variable equal it.

$lastcommand = $world->GetCommandList(1);

This sadly is not working. Could someone be kind of enough to tell me the correct syntax of this function.
Amended on Mon 08 Jan 2007 08:04 PM by Databug
Australia Forum Administrator #1
GetCommandList returns a variant array. This seems particularly hard to use the way the Perl scripters have implemented the Perl interface. See the example here:

http://www.gammon.com.au/scripts/doc.php?function=GetCommandList


Based on that example, maybe this would work for you:


foreach $item (Win32::OLE::in ($world->GetCommandList (1)))
 {
 $lastcommand = $item;
 }


There may be a simpler way, I am not enough of a Perl scripting expert to know it.
#2
Ha! Well I'll try look in variant arrays and see exactly how it works.


But your example works perfectly, thanks alot.