Re: "hooking" into another app
Re: "hooking" into another app
- Subject: Re: "hooking" into another app
- From: "Kyle Sluder" <email@hidden>
- Date: Mon, 14 Apr 2008 17:30:41 -0400
On Mon, Apr 14, 2008 at 5:12 PM, Don Arnel <email@hidden> wrote:
> I've only been working with a Mac running Leopard now for about 5 weeks and
> am not familiar with AppleScript or the Script Editor. I ran the Script
> Editor and dragged the iChat.app (since you said that app had lots of
> handlers) file into it, but what am I looking for? I saw no scripting
> interface. Am I doing it wrong? Is that how I was suppose to "drop it on
> Script Editor"?
Scriptable applications provide what are known as "dictionaries" of
their "terminology". You can open an application's dictionary using
the Open Dictionary item on Script Editor's File menu.
Under the hood, AppleScript is just a human-readable representation of
Apple Events, which are the primitive IPC mechanism on Mac OS (well,
if you don't want to talk about kernel-level IPC through mach ports or
BSD-layer IPC with pipes and sockets, that is). Apple Events are
somewhat analogous to Windows messages like WM_CLOSE, but they are a
lot more structured and versatile.
When you right-click and application's Dock icon and click Quit, for
example, the OS is actually sending that app a Quit Apple Event. This
is just like when you quit an application from the Task Manager in
Windows (in that case, Windows posts a quit event to the app's message
queue -- actually its first top-level window -- which is usually
special-cased in the app's message pump).
But the similarities pretty much end there. Windows also uses
messages for a lot of internal message passing. Also, in Windows,
pretty much everything is a window, and you can iterate through all
the windows owned by any process you own (generalizing here in the
context of security descriptors). Neither of these is the case on OS
X. You have no access to another application's internal structures
whatsoever; you only have access to what the application grants you,
which in most cases is merely Apple Events/AppleScript. In this
sense, Apple Events are used more like COM.
Long story short, you're going to need to seriously retrain yourself
for how OS X is architected. It is a very different beast from
Windows.
--Kyle Sluder
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden