Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Removing Applications from the Dock Programmatically



On Aug 26, 2008, at 5:34 PM, Kevin Kicklighter wrote:

I need to remove applications that were on the the Dock, programmatically (running Leopard 10.5.4). Does anyone have a clue as to how I could accomplish this?

You can access that information through NSUserDefaults as follows:

NSUserDefaults *theDefaults = [NSUserDefaults standardUserDefaults];
NSDictionary *dockDict = [theDefaults persistentDomainForName:@"com.apple.dock"];
NSArray *apps = [dockDict valueForKey:@"persistent-apps"];

for(NSDictionary *anApp in apps)
{
NSLog([[anApp valueForKey:@"tile-data"] valueForKey:@"file-label"]);
}


Tread carefully here because you could easily hose the Dock preferences while doing this.

Here's some more reading on the subject of user defaults:
<http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSUserDefaults_Class/Reference/Reference.html >
_______________________________________________


Cocoa-dev mailing list (email@hidden)

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/email@hidden

This email sent to email@hidden
References: 
 >Removing Applications from the Dock Programmatically (From: Kevin Kicklighter <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.