I wrote an Applescript that would monitor a folder for new input. On receiving the new item, it would open iTunes, create a playlist and add the new files into the playlist. However, when I attach the script as a Folder Action via Folder Action Setup and add a new item, nothing happens. I have placed the script inside /Library/Scripts/Folder Action Scripts as well as ~/Library/Scripts/Folder Action Scripts but it still doesn't fire. Here is my code below:
global album_name
global artist_album
on adding folder items to this_folder after receiving added_items
--get the name of the added folder
repeat with x in added_items
copy name of x as string to playlist_name
set AppleScript's text item delimeters to "-"
set delimited_playlist_name to every text item of playlist_name
set artist_name to text item 1 of delimited_playlist_name
set album_name to text item 2 of delimited_playlist_name
set AppleScript's text item delimeters to ""
end repeat
tell "Finder" to activate "iTunes"
tell application "iTunes"
if not (exists playlist album_name) then
--make iTunes playlist
make playlist with properties {name:album_name}
--add the tracks to the iTunes playlist
repeat with song in playlist_name
add song to playlist album_name
set album of song to album_name
set artist of song to artist_name
set comment of song to ""
set composer of song to ""
set grouping of song to ""
set description of song to ""
set long description of song to ""
set (volume adjustment) of song to 100
end repeat
set view of browser window to album_name
end if
end tell
end adding folder items to
I'm running Mac OS 10.8.4