OS X Recent Items
Jim Sims
sims at ezpzapps.com
Fri Apr 24 00:22:08 EDT 2009
On Apr 24, 2009, at 2:32 AM, Kay C Lan wrote:
>> Déjà-vu, Jim didn't we have this thread in March?
<snip>
>> http://macscripter.net/viewtopic.php?id=17554
<snip>
> Can't you skin this cat with AppleScript?
Kay - thank you returning me to that web page. I think I need my ESM
(Earthling Stress Module) refitted ;-)
Life itself sometimes obscures my view though the windshield, often my
dang rearview mirror seems useless :-P Thanks for looking back for
me.
On that web page, with applescripts from 2002 onwards, is a reference
to CLI records. That one looks like the one I am looking for.
It turns: <00000000 00b20003 00000000 c42cec16 0000482b 00000000
0002ed9e 02575bea 0000c616 84470000 00000920 fffe0000 00000000
0000ffff ffff0001 000c0002 ed9e0002 ed930000 60b7000e 001e000e
0065006d 00610069 006c0041 006c0065 00720074 002e006a 00700067
000f000a 0004006d 00610069 006e0012 00245573 6572732f 6a696d73
696d732f 4465736b 746f702f 656d6169 6c416c65 72742e6a 70670013
00012f00 00150002 000effff 0000>
into: document file "emailAlert.jpg" of folder "CoverImages" of folder
"LH" of folder "Desktop" of folder "jimsims" of folder "Users" of
startup disk of application "Finder"
Easy to pull what I need from that.
Phew. Once again, thanks Kay.
I'm including that applescript in this email in case someone up the
road of Time looks into their rearview mirror for this same sort of
thing. The Archives are our friends - Long live the Archives. Long
live the List.
sims
------ applescript for recent items -----
on getAliasesFrom(CLIrecords)
set theAliases to {}
set tempFile to (path to temporary items as Unicode text) &
"aliasData.dat"
set fRef to (open for access file tempFile with write permission)
try
repeat with i from 1 to (count CLIrecords)
set eof fRef to 0
write |Alias| of item i of CLIrecords to fRef
set thisAlias to (read fRef from 1 as alias)
try -- Check the alias before including it in the list.
info for thisAlias
set end of theAliases to thisAlias
on error number -43
display dialog "The file “" & thisAlias & "” no longer exists."
buttons {"OK"} default button 1
end try
end repeat
end try
close access fRef
return theAliases
end getAliasesFrom
set recentitems to (path to preferences as Unicode text) &
"com.apple.recentitems.plist"
tell application "System Events"
set riInfo to contents of property list file recentitems
set appInfo to |CustomListItems| of (get value of property list item
"Applications" of riInfo)
set docInfo to |CustomListItems| of (get value of property list item
"Documents" of riInfo)
set servInfo to |CustomListItems| of (get value of property list item
"Servers" of riInfo)
end tell
tell application "Finder"
set sortedApps to (sort my getAliasesFrom(appInfo) by modification
date)
set sorteddocs to (sort my getAliasesFrom(docInfo) by modification
date)
-- set sortedServers to (sort my getAliasesFrom(servInfo) by
modification date) -- Servers must be mounted.
end tell
More information about the use-livecode
mailing list