This posting is older than 6 months and can contain outdated information.
Ok.... My roommate and I have gone a little nuts and have come up with a way display the contents of the Movies folder on a RB menu sorted by Date Modified that launches whatever file is selected in VLC. We have also added a 'folder action' to the Movies folder that updates the Date Modified of whatever files are added to it... end result: We have RB menu item that when clicked, always shows us the lastest files added to our Movies folder... crazy right?
Here is the applescript:
--works inside Remote Buddy
set files_list to do shell script "ls -t ~/Movies"
set myList to stringToList for files_list from (ASCII character 13)
set menu_list to {}
set _count to 1
repeat with theCurrentValue in myList
set the end of menu_list to theCurrentValue
set the end of menu_list to theCurrentValue
end repeat
tell application "Remote Buddy Express"
showmenu with items menu_list menu name "example"
end tell
on menureturn(hiddenID, menuname)
tell application "Finder"
set file_to_open to ((home as string) & "Movies:" & hiddenID)
end tell
tell application "VLC"
activate
open file_to_open
end tell
end menureturn
on stringToList for theString from stringDelimiter
tell AppleScript
set oT to text item delimiters
set text item delimiters to stringDelimiter
set outList to text items of theString
set text item delimiters to oT
return outList
end tell
end stringToList
__________________
And, here is the folder action:
on adding folder items to this_folder after receiving these_items
tell application "Finder"
try
repeat with i from 1 to number of items in these_items
set this_item to item i of these_items
activate
--display dialog "Doing it"
do shell script "touch " & (quoted form of POSIX path of this_item)
end repeat
on error error_message number error_number
if the error_number is not -128 then
tell application "Finder"
activate
display dialog error_message & "touch" & (quoted form of POSIX path of this_item) buttons {"Cancel"} default button 1 giving up after 120
--display dialog "touch " & (quoted form of POSIX path of this_item)
end tell
end if
end try
end tell
end adding folder items to