Perfect thanks! The only minor tweak is that the AE doesn't coerce into an int32Value (you always get 0), instead I used the enumCodeValue method and it works as advertised.
For the question about why I want to know - I have a preference option to say don't open a default window if the application was opened at login. This is different to choosing hidden in the login item because the application can pop up windows on other events (which do not override hiding on purpose). That doesn't read very clearly - I hope it makes sense to anyone who cares :) Mark. On Wed, Nov 26, 2008 at 6:33 PM, Ken Thomases <[EMAIL PROTECTED]> wrote: > 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 > > -- Mark Aufflick contact info at http://mark.aufflick.com/about/contact _______________________________________________ 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]
