Re: Recent Items
Re: Recent Items
- Subject: Re: Recent Items
- From: Shane Stanley <email@hidden>
- Date: Thu, 10 Apr 2014 22:39:56 +1000
On 10 Apr 2014, at 8:14 am, koenig.yvan <email@hidden> wrote:
Maybe somebody will have posted a fine code before I wake up.
Alas, you're probably wide awake by now. Here's an ASObjC-based handler to get just the names:
use framework "Foundation"
on returnRecentAppNames() set thePath to current application's NSString's stringWithString:"~/Library/Preferences/com.apple.recentitems.plist" set theDict to current application's NSDictionary's dictionaryWithContentsOfFile:(thePath's stringByExpandingTildeInPath()) return (theDict's valueForKeyPath:"RecentApplications.CustomListItems.Name") as list end returnRecentAppNames
And if you want the paths:
use framework "Foundation"
on returnRecentAppPaths() set thePath to current application's NSString's stringWithString:"~/Library/Preferences/com.apple.recentitems.plist" set theDict to current application's NSDictionary's dictionaryWithContentsOfFile:(thePath's stringByExpandingTildeInPath()) set theBookmarkData to (theDict's valueForKeyPath:"RecentApplications.CustomListItems.Bookmark") as list set thePaths to {} repeat with aData in theBookmarkData set theInfo to (current application's NSURL's resourceValuesForKeys:{current application's NSURLPathKey} fromBookmarkData:aData) set end of thePaths to (theInfo's valueForKey:(current application's NSURLPathKey)) as text end repeat return thePaths end returnRecentAppPaths |
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden
References: | |
| >Recent Items (From: "koenig.yvan" <email@hidden>) |