Hello David,

On Jul 8, 2007, at 9:47 PM, David Micklem wrote:

Hi,

Nobumi's method (with the direct tell application "MacPerl") works
perfectly for me on OS9.2 and MacPerl 5.6.1.

However, I only get  output returned if MacPerl has previously ever
had an output window open.


That is strange. On my machine, I get the result without the output window open. But...

That is, if MacPerl isn't running, then it starts up OK when I run the
script but I get no output/returned value. Re-running the script ->
still no output.

But if I go into MacPerl and either run a script, or syntax check a
script so that the MacPerl output window opens, then re-running the
AppleScript gives me the expected output. Even after I close the
MacPerl output window, running the AppleScript still works OK.

So, just out of curiosity, is it possible to make the script work
WITHOUT the user having to manually go into MacPerl and persuade it to
open an output window?

I think the following will open the output window:

tell application "MacPerl"
        activate
        Do Script "print \"hello!\";" with check
end tell

So, if you want, you can do something like:

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"
        activate -- or you can comment out this line, if MacPerl is running...
        Do Script "print \"hello!\";" with check
        Do Script perl_arg mode Batch
end tell

Best regards,

Nobumi Iyanaga
Tokyo,
Japan

Reply via email to