Hello,

On Feb 19, 2004, at 12:04 AM, Joshua Juran wrote:

On Feb 18, 2004, at 9:36 AM, Doug McNutt wrote:

At 21:50 -0800 2/17/04, Chris Nandor wrote:
You can call Mac OS X apps from MacPerl under Classic, so if some other
application provided an event like do shell script, you could use it.

I haven't tried it but I am told that a #!/usr/bin/tcsh script can be made executable in the sense that Finder will run it on a double click or if it's placed in the startup area for a login.

Good idea. You could also write a stay-open AppleScript applet with an event handler that called 'do shell script'.



I don't know if this is what Joshua had in his mind, but I could write an stay-open AppleScript applet, with this VERY SIMPLE script:


on print the_command
        do shell script the_command
        return the result
end print

I saved the script as a stay-open applet, with the name "do_shell_script.app".
Now, I can call it from an AppleScript script, like this:


tell application "do_shell_script"
--      activate
        print "cd ~/; ls"
end tell

From a MacPerl script like this:

$script = <<EOS;
tell application "do_shell_script.app"
        print "cd ~/; ls"
end tell
EOS

print MacPerl::DoAppleScript($script) || die "Could not compile script\n";

=>   "Desktop
        Documents
        Library
        Movies
        Music
        Pictures
        Public
        Sites
        bin"

And I can call it also from within Frontier 4.2.3. I made an application table with the name "do_shell_script"; I created a script in it, named "print":

on print (shell_script) {
        return (core.print (do_shell_script.id, string (shell_script)))}

"Desktop\rDocuments\rLibrary\rMovies\rMusic\rPictures\rPublic\rSites\rbi n"

Thank you for the idea!

Best regards,

Nobumi Iyanaga
Tokyo,
Japan



Reply via email to