Discussion:
Translating AppleScript to AppleEvents
Gregory Weston
2011-07-25 03:15:36 UTC
Permalink
Years ago, I used a technique described in a blog posting at Unsanity to figure out the appropriate AppleEvent to send to represent a given AppleScript. That blog entry is here: http://unsanity.org/archives/000107.php

I'm wondering if anyone knows how to accomplish the same thing on Intel-based machines. I'm hopeful that it's a simple matter of replacing the $r3 register argument with something else but I don't know enough about modern Intel architectures to know what that might be.

Thanks in advance.

Greg
John Hawkinson
2011-07-25 13:47:19 UTC
Permalink
The now-defunct Apple TN2124
(http://web.archive.org/web/20101109192900/http://developer.apple.com/library/mac/#/web/20101113130453/http://developer.apple.com/library/mac/technotes/tn2004/tn2124.html)
explains that $r3 is the first paramters. On an Intel architecture, that is
on the stack. The gdb example uses 'fut', which is 'future-break', which
I believe should set the breakpoint after the stack setup,
in which case TN2124 directs you to use *(int *)($ebp+8).

If I'm wrong and it's before the stack setup, then it is relative to the stack pointer not the base pointer and you should use *(int *)($esp+4).

--***@mit.edu
John Hawkinson
Post by Gregory Weston
I'm wondering if anyone knows how to accomplish the same thing on
Intel-based machines. I'm hopeful that it's a simple matter of
replacing the $r3 register argument with something else but I don't
know enough about modern Intel architectures to know what that might
be.
Gregory Weston
2011-07-25 16:34:47 UTC
Permalink
Excellent. Thank you. I'll give that a try this evening.
Post by John Hawkinson
The now-defunct Apple TN2124
(http://web.archive.org/web/20101109192900/http://developer.apple.com/library/mac/#/web/20101113130453/http://developer.apple.com/library/mac/technotes/tn2004/tn2124.html)
explains that $r3 is the first paramters. On an Intel architecture, that is
on the stack. The gdb example uses 'fut', which is 'future-break', which
I believe should set the breakpoint after the stack setup,
in which case TN2124 directs you to use *(int *)($ebp+8).
If I'm wrong and it's before the stack setup, then it is relative to the stack pointer not the base pointer and you should use *(int *)($esp+4).
John Hawkinson
Post by Gregory Weston
I'm wondering if anyone knows how to accomplish the same thing on
Intel-based machines. I'm hopeful that it's a simple matter of
replacing the $r3 register argument with something else but I don't
know enough about modern Intel architectures to know what that might
be.
Matt Neuburg
2011-07-27 13:54:43 UTC
Permalink
% setenv AEDebugSends 1 # print sent events
% setenv AEDebugReceives 1 # print received events and replies
That approach is also documented in an early chapter of my AppleScript book. Of course, another way to do this is to run your script in Script Debugger, which can show you the equivalent AEPrint rendering of the raw Apple event in the Log. m.

--
matt neuburg, phd = ***@tidbits.com, http://www.apeth.net/matt/
pantes anthropoi tou eidenai oregontai phusei
Among the 2007 MacTech Top 25, http://tinyurl.com/2rh4pf
Programming iOS 4! http://www.apeth.net/matt/default.html#iosbook
RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html
TidBITS, Mac news and reviews since 1990, http://www.tidbits.com

Loading...