views:

179

answers:

3

My son has a MacOS 9 box to which he is sending remote AppleEvents from his Leopard-based MacBook. Is there any way, programmatically, that I can send remote AppleEvents via TCP/IP from my Windows 7 Toshiba?

+1  A: 

Sniff the packets between the MacBook and the MacOS 9 box using something like tcpdump or Wireshark. This will tell you what an AppleEvent looks like on the wire.

Then replicate those packets using your programming environment of choice on Windows.

I suggest wrapping up the code that you write into a library that you can reuse in other applications.

Good luck - this might be quite tricky!!

tomfanning
yes, I was just reading some of the ADC documentation on the structure of AE records. It's going to be an interesting journey.
boost
+1  A: 

if you're talking about growl notification, there are libraries to use that. for example, here is the growl library for ruby

Tim Hoolihan
Nice idea, but MacOS 9 doesn't implement growl, AFAICT.
boost
+2  A: 

If it helps, apple events are sent on port 3031 via TCP/UDP.

From the high level, there are four pieces to apple events:

  1. The data aggregation API (data requests are put into an opaque in memory structure). This API as it stands was wordy and painful to use. Thank goodness you have access to languages that have better data aggregation tools
  2. Conversion/serialization - the opaque data structure is turned into something that can be serialized and transported to another process and for same machine events, this may be a null serialization
  3. Transport the data is transported from one process to another. Single machine is probably just enqueuing a copy of the data. Remote machine is transport over a network protocol, which could be TCP/IP (but it works with AppleTalk as well) and may require authentication.
  4. Deserialization/Conversion

You will most likely need to do steps 2, 3, and 4. If you don't care about getting any information back, you can skip 4, since one of the flags in a sent event is "no reply".

There are a relatively small number of types in the AE data model. I would write code on your OS X machine to send each and every type and reverse engineer the packets when they're sent. To speed up the process you might want to use appscript, on the OS X machine which will let you send events from Ruby, Objective C, or Python.

plinth