• 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: Recent Items Menu
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Recent Items Menu


  • Subject: Re: Recent Items Menu
  • From: Brian Webster <email@hidden>
  • Date: Thu, 7 Nov 2002 14:56:58 -0600

Oops, didn't read the question closely enough. Apparently I also hit "v" instead of "command-v" when pasting the subject line. :)

The recent items in the Apple menu are stored in the defaults database under the com.apple.recentitems identifier. You can see the contents of that domain by typing "defaults read com.apple.recentitems" or by viewing the com.apple.recentitems.plist file in your Preferences folder.

Programatically, you can change this domain using the NSUserDefaults class. Something along these lines should do the trick:

NSUserDefaults* defaults = [NSUserDefaults standardDefaults];
NSMutableDictionary* dict = [[defaults persistentDomainForName:@"com.apple.recentitems"] mutableCopy];

//Clear out what you want here, for example
[dict setObject:[NSArray array] forKey:@"apps"];

[defaults setPersistentDomain:dict forName:@"com.apple.recentitems"];

Or, if you want to be really brutal:

[defaults removePersistentDomainForName:@"com.apple.recentitems"];

But this will clear everything in that domain, including preferences set by the user for number of docs saved, etc.

Do take note that this isn't really an official API (no official API exists for this), and thus could very easily break if Apple chooses to change the format in which things are stored in a future release of the system.

On Thursday, November 7, 2002, at 02:40 PM, Michael Swanson wrote:

Brian,

Thanks for the reply, but I've already tried that and it doesn't work. That will clear a NSDocument based application's RecentDocuments menu. Doesn't touch finder's Recent Items menu.

Thanks though,

Michael



On Thursday, November 7, 2002, at 02:38 PM, Brian Webster wrote:

On Thursday, November 7, 2002, at 02:01 PM, email@hidden wrote:

Hi,

Does anyone know the call (or even apple script) to Clear the "Recent
Items" menu for Finder? The menu I'm talking about is under the Apple
Menu -> Recent Items -> Clear Menu.

[[NSDocumentController sharedDocumentController] clearRecentDocuments:nil];

--
Brian Webster
email@hidden
http://homepage.mac.com/bwebster




--
Brian Webster
email@hidden
http://homepage.mac.com/bwebster
_______________________________________________
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.

  • Prev by Date: Copying files to an iDisk
  • Next by Date: Re: NSSound
  • Previous by thread: Re: Copying files to an iDisk
  • Next by thread: [repost] Copying files to an iDisk
  • Index(es):
    • Date
    • Thread