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

Re: Recent Items


  • Subject: Re: Recent Items
  • From: Kevin Meaney <email@hidden>
  • Date: Thu, 10 Apr 2014 18:33:19 +0100

This has been a very informative discussion.

Just to let you know that, though this doesn't actually contribute to the discussion what I've learnt without having to do any research is that I can do the following:

set theSize to {width:20, height:10}
set theOrigin to {x:100, y:200}
set theRect to {origin:theOrigin, |size|:theSize}
set theRecord to {destination:theRect, texttodraw:"The text"}
set newFilePath to ((path to desktop) as text) & "size_record"
tell application "System Events"
  set propertyListItem to make new property list item with properties {kind:record, value:theRecord}
  make new property list file with properties {contents:propertyListItem, name:newFilePath}
end tell

Which will help me immensely in the future.

Kevin

On 10 Apr 2014, at 17:11, koenig.yvan <email@hidden> wrote:


Le 10/04/2014 à 14:39, Shane Stanley <email@hidden> a écrit :

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

-- 
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>
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
  • Follow-Ups:
    • Re: Recent Items
      • From: Kevin Meaney <email@hidden>
    • Re: Recent Items
      • From: "koenig.yvan" <email@hidden>
References: 
 >Recent Items (From: "koenig.yvan" <email@hidden>)
 >Re: Recent Items (From: Shane Stanley <email@hidden>)
 >Re: Recent Items (From: "koenig.yvan" <email@hidden>)

  • Prev by Date: Re: names of a record's items
  • Next by Date: Re: Recent Items
  • Previous by thread: Re: Recent Items
  • Next by thread: Re: Recent Items
  • Index(es):
    • Date
    • Thread