Re: 10.6 MacPerl - no appropriate 64-bit architecture
[email protected] (Gavin Brock)
| Newsgroups | perl.macosx |
|---|---|
| Message-ID | <[email protected]> |
On 30 Aug 2009, at 05:06, [email protected] wrote: > Mac::Glue and Mac::Carbon are again based on Carbon, and won't work > in 64-bit. > > Though I haven't used it myself, "use Foundation;" will load in the > PerlObjCBridge module (which is 64-bit) and then you can use > NSAppleScript class to run an AppleScript script (as I understand it). Thanks for the pointer Ed - I looked through: http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSAppleScript_Class/Reference/Reference.html So I'm guessing that for simple calls I can replace: > use MacPerl; > MacPerl::DoAppleScript('tell application "Terminal" to activate'); with: > use Foundation; > my $as = NSAppleScript->alloc->initWithSource_('tell application > "Terminal" to activate'); > my $err = $as->executeAndReturnError_(undef); But what would be the equivalent, if I wanted to capture the returned value? > my $win = MacPerl::DoAppleScript('tell application "Terminal" to > return front window'); > warn $win; Thanks, Gavin