Re: Adding something to the login items
Re: Adding something to the login items
- Subject: Re: Adding something to the login items
- From: Arthur VIGAN <email@hidden>
- Date: Sun, 13 Apr 2003 16:27:18 +0200
how can my application add something to the login items in the system
preferences?
The preference is stored inside
~/Library/Preferences/loginwindow.plist, inside an array called
"AutoLaunchedApplicationDictionary" and you can interact with this
array by loading the persistent domain "loginwindow" through
NSUserDefaults.
So you can just add a new dictionary object with the appropriate
objects and keys filled out, and put that into the array. That said,
please ask the user before making changes to this preference...
I tried this, but I can't add a dictionnary to the
"AutoLaunchedApplicationDictionary" array, as it is not a mutable
array. I used the following code:
NSUserDefaults *loginDefaults = [[NSUserDefaults alloc] init];
NSDictionary *loginWindowDict = [NSDictionary
dictionaryWithDictionary:[loginDefaults
persistentDomainForName:@"loginwindow"]];
NSMutableArray *loginItemArray = [NSArray
arrayWithArray:[loginWindowDict
objectForKey:@"AutoLaunchedApplicationDictionary"]];
NSDictionary *myDict;
myDict = [NSDictionary dictionaryWithObjects:[NSArray
arrayWithObjects:@"/Volume/Arthur/rien", [NSNumber numberWithBool:1],
nil] forKeys:[NSArray arrayWithObjects:@"Path", @"Hide", nil]];
[loginItemArray addObject:myDict];
but it doesn't work. Where am I wrong?
-- Arthur
_______________________________________________
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.