I am trying to create an applescript for a dropbox folder so that when a new file is added to the folder, it will automatically add that file to a particular playlist in iTunes (the goal being to be able to update multiple computers' playlists remotely by just adding one file to one dropbox folder.)
The applescript works with the exception of adding the file into the iTunes playlist. It is a bit tricky to debug because it is a folder action so it cannot be run in script editor. I have been using display dialog to try to understand what is happening but the dialogs show what looks like correct information to me so I am stumped. Any help is greatly appreciated!
I have tried using a POSIX path instead, I have tried setting the item as an alias, as a string, I've tried setting the item to another variable with "\"" & item & "\""
set playlistToUpdate to "Public News Service"
on adding folder items to theFolder after receiving theNewItems
set filesAdded to {}
repeat with i from 1 to count of theNewItems
set thisItem to item i of theNewItems as alias
tell application "iTunes"
launch
delay 2
display dialog thisItem
add thisItem to playlist playlistToUpdate
end tell
end repeat
end adding folder items to