Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'An AppleScript to tidy up the Desktop' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
An AppleScript to tidy up the Desktop
Authored by: rajanarora on Nov 10, '06 01:05:13PM

This is fantastic! Here is a slightly modified folder action version which works 'on open' for the folder 'Desktop'.

on opening folder desktop
tell application "Finder"
set myDesktop to alias ((path to desktop folder as text))

-- folders to sort into
set myMusic to alias ((path to desktop folder as text) & "Music")
set myPrograms to alias ((path to desktop folder as text) & "Programs")
set myPics to alias ((path to desktop folder as text) & "Pics")
set myTorrents to alias ((path to desktop folder as text) & "Torrents")
set myVideos to alias ((path to desktop folder as text) & "Video")
set myDocs to alias ((path to desktop folder as text) & "Documents")

--extension lists
set musicExt to {".mp3", ".aac"}
set programsExt to {".dmg", ".sit", ".app"}
set picsExt to {".jpg", ".gif", ".tif", ".png", ".psd"}
set torrentsExt to {".torrent"}
set videosExt to {".avi", ".mpg", ".mov"}
set docsExt to {".pdf", ".txt", ".php", ".doc", ".xls", ".sav", ".key", ".html", ".htm", ".pages", ".jmp"}

set allFiles to files of myDesktop
repeat with theFile in allFiles
copy name of theFile as string to FileName

repeat with ext in musicExt
if FileName ends with ext then
move theFile to myMusic
end if
end repeat

repeat with ext in programsExt
if FileName ends with ext then
move theFile to myPrograms
end if
end repeat

repeat with ext in picsExt
if FileName ends with ext then
move theFile to myPics
end if
end repeat

repeat with ext in torrentsExt
if FileName ends with ext then
move theFile to myTorrents
end if
end repeat

repeat with ext in docsExt
if FileName ends with ext then
move theFile to myDocs
end if
end repeat

repeat with ext in videosExt
if FileName ends with ext then
move theFile to myVideos
end if
end repeat

end repeat
end tell
end opening folder



[ Reply to This | # ]