• 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: Thomas Fischer <email@hidden>
  • Date: Thu, 10 Apr 2014 09:22:59 +0200

Good morning Yvan,

I didn't quite understand why you need to "decipherAbookmark".

Does this script do what you want?

set recentPrefs to (path to preferences folder from user domain as text) & "com.apple.recentitems.plist"
tell application "System Events"
	set recentApps to {}
	value of property list file recentPrefs
	RecentApplications of result
	set theCustomItems to CustomListItems of result
	set recentApps to {}
	set {oTIDs, AppleScript's text item delimiters} to {AppleScript's text item delimiters, {".app"}}
	repeat with anItem in every item of theCustomItems
		set theName to |name| of anItem
		copy text item 1 of theName to the end of recentApps
	end repeat
	set AppleScript's text item delimiters to oTIDs
end tell
set maybe to choose from list recentApps
if maybe is false then error number -128
activate application (maybe as text)

Best
Thomas

Am 10.04.2014 um 00:14 schrieb koenig.yvan:

> #[SCRIPT]
> set recentPrefs to (path to preferences folder from user domain as text) & "com.apple.recentitems.plist"
> tell application "System Events"
> 	set recentApps to {}
> 	value of property list file recentPrefs
> 	RecentApplications of result
> 	set theCustomItems to CustomListItems of result
> 	set recentApps to {}
> 	repeat with anItem in every item of theCustomItems
> 		set end of recentApps to my decipherAbookmark(bookmark of anItem)
> 	end repeat
> end tell
>
> set maybe to choose from list recentApps
> if maybe is false then error number -128
> activate application (maybe as text)
>
> #=====
> #
> # It's this handler which is boring me
> #
> on decipherAbookmark(bMark)
> 	try
> 		bMark as text
> 	on error errMsg number errNbr
> 		offset of "«data" in errMsg
> 		set errMsg to text (result + 6) thru -1 of errMsg
> 		offset of "»" in errMsg
> 		set errMsg to text 1 thru (result - 1) of errMsg
> 		set enListe to {}
> 		repeat with i from 1 to count errMsg by 2
> 			try
> 				tell me to set end of enListe to character id (my hex2num(text i thru (i + 1) of errMsg))
> 			end try
> 		end repeat
> 		set {oTIDs, AppleScript's text item delimiters} to {AppleScript's text item delimiters, ""}
> 		set enTexte to enListe as text
> 		set enTexte to item -2 of my decoupe(enTexte, ".app")
> 		set enTexte to item -1 of my decoupe(enTexte, ";") & ".app"
> 		set AppleScript's text item delimiters to oTIDs
> 		return enTexte
> 	end try
> end decipherAbookmark
>
> #=====
>
> on decoupe(t, d)
> 	local oTIDs, l
> 	set {oTIDs, AppleScript's text item delimiters} to {AppleScript's text item delimiters, d}
> 	set l to text items of t
> 	set AppleScript's text item delimiters to oTIDs
> 	return l
> end decoupe
>
> #=====
>
> on hex2num(t)
> 	return ((offset of (text item 1 of t) in "0123456789ABCDEF") - 1) * 16 + (offset of (text item 2 of t) in "0123456789ABCDEF") - 1
> end hex2num
>
> #=====
> #[/SCRIPT]


 _______________________________________________
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>)

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