Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

aendaman

macrumors member
Original poster
May 28, 2008
57
0
hi,

i try to write an apple script to use as folder action which, when copying files to that folder will adds them to a specific itunes playlist and set them bookmarkable.

so far i put this together from snippets i found:


property DELAY_TIME_SECONDS : 5 -- How long to wait between checking file size.

on adding folder items to my_folder after receiving the_files

repeat with i from 1 to number of items in the_files
set oldSize to 0
set newSize to -1
-- When newSize equals oldSize, it means the copy is complete because the size hasn't changed.
repeat while newSize is not equal to oldSize
-- Get the file size.
set oldSize to size of (info for i)
delay DELAY_TIME_SECONDS
-- Sample the size again after delay for comparison.
set newSize to size of (info for i)
end repeat

tell application "iTunes"
launch
try
set this_file to (item i of the_files)
add this_file to playlist "test"
set bookmarkable of this_file to true

end try
end tell
end repeat
end adding folder items to



i compiled and saved it in ~/Library/Scripts/Folder Action Scripts then added it to the folder as folder action but when i drop a file into the folder, nothing happens in iTunes.

any help appreciated
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.