At 19:33 -0500 2002.07.12, Jeff Lowrey wrote:
>At 4:13 PM -0700 7/12/02, Noah Hoffman wrote:
>>      I'm porting some perl files that used to run in MacPerl 5.6.1
>>to OS X and Perl 6.  The scripts had to call some AppleScript with
>>MacPerl::DoAppleScript() but this no longer works in Perl 6.  Does
>>anyone know the new way to call an AppleScript from Perl?
>
>MacPerl::DoAppleScript is part of MacPerl, not perl - ergo not
>included with perl 6.
>
>You can either port MacPerl::DoAppleScript, or invoke osascript from
>a system call or backticks.

There is no such thing as Perl 6.  It is in development, but currently does
not exist except in a partial specification.  Perhaps you mean Perl 5.6?
The perl that comes with Mac OS X is 5.6, though 5.6.1 mostly works, and
5.8 will work on Mac OS X too.

If so, there are plenty of ways.  My YAPC slides include a few.

        http://pudge.net/macperl/yapc/2002/

To the point, you can use osascript from perl, either directly or via the
OSXMacPerl module, which emulates some MacPerl.pm functionality on Mac OS X.

        http://pudge.net/macperl/yapc/2002/macperl/slide010.html
        http://pudge.net/macperl/yapc/2002/macperl/slide019.html

Examples:

% osascript -ss -e 'get path to startup disk as text'
"Bourque:"
% osacompile -o getpath -e 'get path to startup disk as text'
% osascript -ss getpath
"Bourque:"

% perl -MOSXMacPerl -le 'print MacPerl::DoAppleScript("get path to startup
disk as text")'
"Bourque:"

You can also use MacPerl 5.6.1 to communicate with Mac OS X apps, which the
slides also show examples of.

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

Reply via email to