Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

pudge (1)

  (email not shown publicly)
AOL IM: Crimethnk (Add Buddy, Send Message)

I run this joint, see?

Journal of pudge (1)

Friday October 31, 2003
12:44 PM

Mac::Glue with Remote Computers

[ #15507 ]

I never got around to figuring out how to do remote Apple events with Mac OS X. All I knew is that the old method from Mac OS of filling in a complex data structure didn't work.

It worked great on Mac OS, but wouldn't work on Mac OS X. So tonight I decided to figure it out, and I did. Instead of packing the data structure, I just construct a URL. That's all. Something like eppc:// And Mac::Glue makes it even simpler:

# normal way, for local Finder
$finder = new Mac::Glue 'Finder';
# method for remote Finder
$finder = new Mac::Glue 'Finder', eppc => Finder => '';

That's it. Then use $finder as though it were local. Of course, there is the issue of security. You can pass the username and password to the constructor, or just pass the username and get a dialog box asking for the password. If neither is included, you'll get a dialog box, too. Either way, click "Add to Keychain?" and you never have to see the dialog box again, for that username/hostname combination.

There's also a place in the URL for specifying UID or PID, in those cases where more than one app of that name is running. I tested this and it didn't work, it just chose one and sent the event to that app every time, no matter what. Hm.

Regardless, it's working. Send events to your other Macs. Astound your friends. Requires today's newly updated Mac::Carbon, Mac::AppleEvents::Simple, and Mac::Glue.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.