Re: Test for launched from (Apple)Script?
Re: Test for launched from (Apple)Script?
- Subject: Re: Test for launched from (Apple)Script?
- From: Matt Neuburg <email@hidden>
- Date: Wed, 10 Nov 2010 13:32:36 -0800
On Wed, 10 Nov 2010 13:34:09 -0500, "McLaughlin, Michael P." <email@hidden> said:
>Is there any standard way for a Cocoa app to test whether it was launched
>from a script, esp. AppleScript?
All apps are launched the same way - by sending them an oapp Apple event (or similar). It doesn't matter whether it came from the Finder (double-clicking the app) or a script; an Apple event is an Apple event. That's the whole point of Apple events; they are a universal system level messaging system.
If the question is "Who is sending me this oapp Apple event?", I don't think there's any way to find that out because in a Cocoa app by the time your code runs that's already happened.
m.
--
matt neuburg, phd = email@hidden, <http://www.apeth.net/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.apeth.net/matt/default.html#applescriptthings_______________________________________________
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