In article <p05101401b888f79cab91@[203.47.34.3]>,
 [EMAIL PROTECTED] (Peter N Lewis) wrote:

> At 21:13 -0500 7/2/02, Brad Rice wrote:
> >How do you call Applescript from Perl? I want to make a CGI that 
> >runs an applescript.
> 
> In MacPerl, use:
> 
> &MacPerl'DoAppleScript(<<"END_SCRIPT");
>         tell application "Finder"
>                 move alias "$folder" to trash
>         end tell
> END_SCRIPT
> 
> I believe MacPerl can also do raw AppleEvents.

Yeah.  MacPerl also has Mac::Glue, a sorta "AppleScript in Perl" 
framework:

   use Mac::Glue;
   my $finder = new Mac::Glue 'Finder';
   $finder->move( $finder->obj(alias => $folder),
                  to => $finder->prop('Trash')
   );

Or one of my favorites:  :)

   $interarchy->edit( path => $rpath, host => $host, user => $user );
   $bbedit->compare( $bbedit->obj(window => 1), $lpath );

When we get Carbon running on Mac OS X, I'll be porting Mac::Glue, too.


> In Mac OS X Perl, use /usr/local/bin/osascript, man osascript for 
> info on how to use it and send the data to it from the Perl script.
> 
> Is there any other ways?

There's a "MacPerl" module for Mac OS X with a similar interface to the 
MacPerl module in MacPerl, whish uses osascript.

   http://news2.ils.uec.ac.jp/~herr/
   http://news2.ils.uec.ac.jp/~herr/OSXMacPerl-0.1.gz

-- 
Chris Nandor                      [EMAIL PROTECTED]    http://pudge.net/
Open Source Development Network    [EMAIL PROTECTED]     http://osdn.com/

Reply via email to