Hi there, totally new to the forums, and totally stoked on AppleScripts (picked up a MacBook in September, just getting around to the fun stuff)!
I read some guides, and a handful of tutorials, and from what I’ve gathered that a script I’ve been writing SHOULD be working, but this is of course only MY opinion (which is wrong, because its not working).
Here is what I was shooting for with this script, before I post the snippet:
- Watch my “Downloads” folder, which is located in /Users/Me
- Sort files as they arrive in my “Downloads” folder according to their extensions to other folders
- Some of these folders are inside of my “Downloads” folder, IE “Compressed” (.dmg, .zip, .rar, and .tar) and “Torrents” (.torrent)
- Others are located in my sidebar, IE “Movies” (.mov, .mpg, etc.), “Music” (.acc, .mp3, etc.), “Pictures” (.jpg, .pct, etc.), and “eLiterature” (.pdf, .cbr, etc.)
And now, the code in its latest mutated form!
on adding folder items to this_folder after receiving these_items
tell application "Finder"
if name of added_file contains ".torrent" then
move added_file to folder "Macintosh HD:Users:Me:Downloads:Torrents:"
else if name of added_file contains {".smi", ".zip", ".dmg", ".img", ¬
".pkg", ".rar", ".tar", ".sit", ".sitx"} then
move added_file to folder "Macintosh HD:Users:Me:Downloads:Compressed:"
else if name of added_file contains {".cbr", ".chm", ".pdf"} then
move added_file to folder "Macintosh HD:Users:Me:eLiterature:"
else if name of added_file contains {".jpg", ".jpeg", ".gif", ".tiff", ¬
".psd", ".tif", ".pct", ".png"} then
move added_file to folder "Macintosh HD:Users:Me:Pictures:"
else if name of added_file contains {".mp3", ".mp4", ".ogg", ".acc", ¬
".wma"} then
move added_file to folder "Macintosh HD:Users:Me:Music:"
else if name of added_file contains {".mpg", ".wmv", ".rm", ".rmvb.", ¬
".avi", ".mov"} then
move added_file to folder "Macintosh HD:Users:Me:Movies:"
end if
end tell
end adding folder items to
Thats that!
Feel free to tear me apart, or offer help in shortening, optimizing, etc. my code, as I’m a total beginner.
Thanks in advance!
Edit: This is not the only forum I’m on, so I’d like to add that I DID use the search function to check to see if I could find a solution before posting, but nothing seemed to work for me