I’m trying to create a folder action that will alert me when I need to back up my eMusic tunes to a DVD-R. I wrote the following script:
tell application "Finder"
if the physical size of folder "My eMusic" is greater than 4.6E+9 then display dialog "Time to backup eMusic"
end tell
This script runs fine, but of course it does no good if I can’t trigger it to run automatically when mp3’s are added to the folder, so I put it inside a folder action routine and attached it to that folder as such:
on adding folder items to this_folder after receiving added_items
try
tell application "Finder"
if the physical size of folder "My eMusic" is greater than 4.6E+9 then display dialog "Time to backup eMusic"
end tell
end try
end on adding folder items to
This produces nothing when an item is added. I know folder actions is properly enabled for this folder because I can get it to run Apple’s “added item alert” script. I’ve monkeyed with variations on the main script language and dialogs inside the script to see where it’s going wrong, but the best I can do is get it to produce the dialog “msng” when I’m trying to get it to display the size of the folder.
This is my first attempt to write a folder action, so I have this feeling I’m missing something elementary. But I’ve searched the forums here and can’t figure out what it might be.
Any help is appreciated.