On Nov 26, 2008, at 12:38 AM, Mark Aufflick wrote:

I'm wondering if it's possible to tell if my application was launched
normally by the user, or if it was launched by virtue of being in the
login items.

You need to look up the Apple Event that is current at the time of your application's launch. Use [[NSAppleEventManager sharedAppleEventManager] currentAppleEvent].

If you're in applicationWill/DidFinishLaunching:, then it should be an "open application" (kAEOpenApplication, a.k.a. 'oapp') event. Then, check the keyAEPropData parameter to see if it matches keyAELaunchedAsLogInItem:

if ([[event paramDescriptorForKeyword:keyAEPropData] int32Value] == keyAELaunchedAsLogInItem)
                // ...

(Note that the parameter may not be present, in which case messaging to nil will cause the above 'if' condition to evaluate to false. That's probably what you'd want, but just wanted to be clear.)

See here:

http://developer.apple.com/documentation/Carbon/Reference/Apple_Event_Manager/Reference/reference.html#/ /apple_ref/doc/uid/TP30000134-CH4g-SW1


Cheers,
Ken

_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to