Hello Louis,
On Jun 29, 2007, at 10:36 AM, Louis Pouzin wrote:
Hi,
Calling a macperl script (dog) from AS, with arguments a, b c,
would read:
tell perl to do script {dog, a, b, c}
Assuming that a, b, c are strings, they are copied to @ARGV in dog.
The problem I have is passing a list of arguments, e.g.
set names to selection -- nb of selected objects not predictable
tell perl to do script {dog, names} -- names conversion fails
Then I can converts names to a list of strings:
set snames to {}
repeat with nam in names
set snames to snames & (nam as text)
end repeat
tell perl to do script {dog, snames} -- dog is called, @ARGV is empty
dog could be:
$\ = "\n"; # print with EOL
print "nb args: ", scalar @ARGV;
$" = "\n"; # separator
print "@ARGV";
If you are using Classic MacPerl, then this works on my machine:
set my_script to "myDocument:Users:ni:Desktop:dog.pl"
set args to {"dog", "cat"}
set perl_arg to {}
set perl_arg to perl_arg & my_script
set perl_arg to perl_arg & args
tell application "MacPerl"
Do Script perl_arg mode Batch
end tell
I hope this helps you.
Best regards,
Nobumi Iyanaga
Tokyo,
Japan