Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want to clear the recent items lists on my computer regardless of what piece of software they are from. I know of the following lists so far:

  • Recent Applications, Documents and Servers are all available in the Recent menu in the Apple menu
  • Xcode has a recent projects and recent files menu
  • Safari has something similar as well
  • TextEdit has an Open Recent menu item as well.

How do I clear the items in these menus?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

As far as I know, there is no built-in way this can be done, as the recent documents are stored in each application's preference file. However, a little AppleScript and:

tell application "Finder"
    set fls to every file in alias ":Users:ben:Library:Preferences:"
    set AppleScript's text item delimiters to {""}
    repeat with fl in fls
    	if name extension of fl is "plist" then
    		set fn to name of fl
    		set pid to text items 1 thru -7 of fn as text
    		if pid = "com.apple.Xcode" then
    			try
    				do shell script "defaults delete " & pid & " NSRecentXCFileDocuments"
    				do shell script "defaults delete " & pid & " NSRecentXCProjectDocuments"
    			end try
    		else
    			try
    				do shell script "defaults delete " & pid & " NSRecentDocumentRecords"
    			end try
    		end if
    	end if
    end repeat
end tell
This deals with normal applications and Xcode, but not the Apple menu or other applications which don't follow the pattern.

share|improve this answer
    
By using Which editor do I type your Code ? Should I Use VI or text editor ? What extension should I give to this code file ? How to execute it ? Thanks for sharing your knowledge with me. –  Sagar R. Kothari Aug 27 '09 at 17:52
1  
Open "Script Editor", paste in the code and click the Run button. It'll take a while, during which time the application will be unresponsive, but don't worry about it. It'll also fill up your log files with annoying messages, but I don't think there's anything I can do about that. –  Benjamin Dobson Aug 27 '09 at 17:54

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.