Re: Can I Send Apple Events in Cocoa?
Re: Can I Send Apple Events in Cocoa?
- Subject: Re: Can I Send Apple Events in Cocoa?
- From: Daniel Jalkut <email@hidden>
- Date: Mon, 12 Dec 2005 10:11:33 -0500
On Dec 12, 2005, at 2:19 AM, Kaydell Leavitt wrote:
I saw some Cocoa code in the project that I'm working
on that was written by my predecessor. He used
embeded Apple Script in the Cocoa/Objective-C app that
I'm working on. I thought that this was not good,
that I could do better writing code in C,
It was probably best to assume that if AppleScript worked, and was
simple to maintain and understand, and was of high enough
performance, then it was good (and better!) than writing code in C to
do the same thing.
but so far,
I've only been able to assume that the database server
and the inventory client app are both running. It's
not likely that there will be two Inventory clients
running, but it can happen. I want to be able to
specify which instance of the Inventory Client gets
the Apple Event if more than one is running.
At *this* point you might have a reasonable argument for switching to
something besides AppleScript. As far as I know there is no way to
coerce AppleScript into targeting a specific process out of many
running copies.
It's hard for me to imagine a scenario in which this "multiple
running copies" arrangement isn't a design flaw. Sounds like a
poorly thought-out Windows port.
The following Apple Script is really what I need, but
with the additional ability to specify an app if two
or more copies are running.
tell application "Inventory Client"
activate
«event InvARTMT»
end tell
I think you're on the right track simply using AppleEvents directly.
Build a list of all the process serial numbers of your target
applications, and send these "InvARTMT" directly to the process
serial number desired.
Daniel
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden