• 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: Installing a new login item?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Installing a new login item?


  • Subject: Re: Installing a new login item?
  • From: Isaac Sherman <email@hidden>
  • Date: Wed, 03 Jul 2002 01:30:25 -0400

Just to hop on the bandwagon, I'd like to pop in here. Rather than use the
more Ugh-ish approach of editting loginwindow.plist directly, I want to use
a standard and safe method to add the items. But my code below doesn't
work. Why? I feel like I'm missing something obvious, but I can't seem to
see it. Any suggestions? Comments? Riddles? Thanks...

<code snippet>

NSMutableDictionary * myDict=[[NSMutableDictionary alloc]init];
NSUserDefaults * defaults = [[NSUserDefaults alloc] init];
NSMutableArray * loginItems;

[myDict setObject:[NSNumber numberWithBool:NO] forKey:@"Hide"];
[myDict setObject:[[NSBundle mainBundle] executablePath]
forKey:@"Path"]; //I probably want to use a
//different path, but this works
//for now

loginItems=[[NSMutableArray arrayWithArray:[[defaults
persistentDomainForName:@"loginwindow"]
objectForKey:@"AutoLaunchedApplicationDictionary"]]
retain];


[loginItems removeObject:myDict];//make sure it's not already in there
[loginItems addObject:myDict];

[defaults setObject:loginItems forKey:
@"AutoLaunchedApplicationDictionary"];
[defaults synchronize]; //Just in case the app quits immediately after

[loginItems autorelease];

</code snippet>

Thanks in advance,

sleep.....

--
Isaac Sherman
MotaSoft Software
http://homepage.mac.com/huperzoevs/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Installing a new login item?
      • From: Sherm Pendley <email@hidden>
  • Prev by Date: Re: Cocoa stripping resource forks: does Jaguar fix?
  • Next by Date: Re: Installing a new login item?
  • Previous by thread: Re: Installing a new login item?
  • Next by thread: Re: Installing a new login item?
  • Index(es):
    • Date
    • Thread