Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Format for Apple Remote Events

If I enable Apple Remote Events in the Preferences > Sharing settings and the send the following AppleScript from another Mac...

tell application "Finder" of machine "eppc://192.168.1.2"
sleep
end tell

the machine targeted, at 192.168.1.2 acknowledges the command and sleeps, but if I wanted to send this command directly from a 3rd party client via TCP port 3031, how should the string be formated exactly? ...or no modification to the text string is required?

17" C2D MBP, G5 XServe, CD Mini, XServe RAID, (2x) MB, MP, Mac OS X (10.5)

Posted on Dec 8, 2007 10:31 AM

Reply
4 replies

Dec 8, 2007 11:08 AM in response to tsvisser

The EPPC protocol is not trivial. That's not to say it can't be done, of course, but it incorporates authentication, message passing, result handling, etc.

Maybe the easiest non-AppleScript way to implement it is via Perl's AppleEvents module as described at http://developer.apple.com/documentation/Darwin/Reference/ManPages/man3/Mac_AppleEvents_Simple.3pm.html, but there are other similar interfaces for other scripting languages.

If you're building an application in Cocoa Apple have a lot of documentation on how to implement AppleEvents in your app, both from a sending and receiving standpoint. http://developer.apple.com/cocoa/applescriptforapps.html would be a good place to start, followed by http://developer.apple.com/documentation/AppleScript/Conceptual/AppleEvents/abou taes_aepg/chapter_2_section4.html

Dec 8, 2007 11:48 AM in response to Camelot

If I enable Mac OS 9 Apple Remote Events, is it possible to remove the authentication component? Does this make the task significantly simpler, or is it too complex? I'm using an embedded controller that can simply send out ASCII unicode text strings. Could it be possible to simply use a port monitor to see the raw data being sent over the TCP socket and copy that, or are the lower level mechanics of this process actually dynamic where the strings sent would be dependent on the environment and target machine variables?

Dec 8, 2007 12:03 PM in response to tsvisser

There is always an authentication component - even in OS 9.

I'd say it's too complex to try and emulate via direct ASCII input, but I don't know if a simple packet sniff/replay would work.

I world look at it from a different angle, though - rather than get the embedded controller to send the AppleEvent, why not have it send a message (any message) to some middleware (like a perl script) and have that middleware generate the appropriate AppleEvents?
This gives you a lot more flexibility since the app in the middle can take logical actions based on the controller input, and it's easier to expand the messaging (e.g. add a new signal)

Dec 8, 2007 12:34 PM in response to Camelot

This is what I'm doing currently... I have written an Cocoa application - heavily AppleScript centric that runs on the target machine. I also have another application that acts as the proxy from an arbitrary TCP socket to my app... just to manage the socket and to pass data to the app.

This works pretty good, but I was trying to streamline the architecture where my embedded controller could speak direct to the target machine without any intermediate proxies...

Format for Apple Remote Events

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.