• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Starting as Startup Item?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Starting as Startup Item?


  • Subject: Re: Starting as Startup Item?
  • From: Darkshadow <email@hidden>
  • Date: Sun, 5 Dec 2004 01:03:50 -0500

You can check the loginwindow.plist file, and see if your application is listed there. This code should do it. Note that the autolaunched applications could be moved in the future to some other plist, or even not saved (like this) at all, but it has been in the loginwindow.plist file since 10.1 (I'm not sure about 10.0; I never looked back then). Keep that in mind if you decide to use this. Also, I think the keys had different names in 10.1, so if you're looking for compatibility with 10.1, you may want to check that out.

- (BOOL)isInAutoLaunchDictionary
{
NSString *loginwindowPlist=[@"~/Library/Preferences/loginwindow.plist" stringByExpandingTildeInPath];
NSDictionary *autoLaunchedApps=[NSDictionary dictionaryWithContentsOfFile:loginwindowPlist];
NSArray *appsArray=[autoLaunchedApps objectForKey:@"AutoLaunchedApplicationDictionary"];
NSEnumerator *anEnum=[appsArray objectEnumerator];
id anObject;


while ((anObject=[anEnum nextObject])) {
if ([[[NSBundle mainBundle]bundlePath] isEqualToString:[anObject objectForKey:@"Path"]]) {
return YES;
}
}


	return NO;
}

Darkshadow (aka Mike Nickerson)

On Dec 4, 2004, at 3:20 AM, Mihkel Tammepuuu wrote:

How can an application determine if it was launched as a Startup Item on logging in to Mac OS or a usual way like (double)clicking it's icon?

//
Mihkel Tammepyy

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
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

  • Follow-Ups:
    • Re: Starting as Startup Item?
      • From: Mark Munz <email@hidden>
References: 
 >Starting as Startup Item? (From: Mihkel Tammepuuu <email@hidden>)

  • Prev by Date: Might be a stupid queston... but
  • Next by Date: Re: Absolute Value |x - y|
  • Previous by thread: Re: Starting as Startup Item?
  • Next by thread: Re: Starting as Startup Item?
  • Index(es):
    • Date
    • Thread