Mac::Glues on Mac OS X
I did some investigation tonight on how to make glues for Mac::Glue from Mac OS X apps. Some observations:
- We sometimes get the AppleScript terminology data in the aete resource from the files themselves. However, there is no one standard in the apps themselves. iTunes.app has a iTunes.rsrc resource fork file which I could open with MacPerl to create the glue; Internet Explorer.app had a similar file, but it was not a resource fork file, it was a plain data file. And Cocoa apps like Mail.app don't have such a file with aete resource at all.
- I suspect that, unlike Mac OS, Mac OS X won't have applications that won't respond to the "ascr\gdte" Apple event, which returns the aete data. In other words, maybe we won't have to parse any file data, and just get it via an event (which is what happens for most apps even under Mac OS 9).
- The observations about being able to get aete data via Apple events doesn't directly apply to Scripting Additions and the "dialect" file. Standard Additions.osax is like Internet Explorer.app
- So to get the data, I think can just drop a package on the droplet, find $package/Contents/PkgInfo, open it up, get the application's signature ("emal" for Mail.app), and then use that to get the aete data. It worked just fine this way for Mail.app, and I created a usable glue and everything:
use Mac::Glue;
Yes, this is MacPerl running under Classic talking to a Cocoa app running under Mac OS X via Apple events with Mac::Glue. And it works with very little modification of Mac::AETE::App and Mac::AETE::Format::Glue.
my $mail = new Mac::Glue 'Mail';
$mail->activate;
$mail->mailto('mailto:pudge@pobox.com'); - Not all the problems are so easily solved, of course. There's the Scripting Additions problem mentioned above; there's also potential problems with launching apps, especially by path instead of signature, etc. All will need to be tested and played with in due time.
- Of course, none of this is entirely useful right now, unless you want to use MacPerl on Mac OS X. The real purpose of this is to know what to do when we can use Mac::Glue under native perl on Mac OS X.
Leave a comment