So, my watch folder script worked pretty well, but it breaks apart if you send more than one file at the folder at a time (for example 6 files at once).
My original script looked something like this…
on adding folder items to thisFolder after receiving theItems
repeat with f in theItems
-- wait for the item to be all there. Since it can take a few minutes for a file to copy over.
set Was to 0
set isNow to 1
repeat while isNow ≠Was
set Was to size of (info for f)
delay 30 -- longer if getting the item is slow
set isNow to size of (info for f)
end repeat
tell application "Finder"
open theItems using application file "ProResTo1920X1080.app" of folder "Desktop" of folder "anton" of folder "Users" of startup disk
end tell
end repeat -- get next item f in thisFolder
end adding folder items to
The problem with the script is that I’m send theItems to the Compressor droplet on each repetion. But sometimes theItems have multiple items. So, that’s bad.
So my new script for this tries to send only the item of the repetition to the Compressor.
on adding folder items to thisFolder after receiving theItems
-- this is the standard intro for a folder action
repeat with f in theItems
set file_name to name of (info for f)
set fileType to kind of (info for f)
set theFile to (file f of theItems)
-- wait for the item to be all there
set Was to 0
set isNow to 1
repeat while isNow ≠Was
-- the basic idea is that the script loops until the file size is the same for more than 30 seconds. That means the file has finished copying.
set Was to size of (info for f)
-- this section is getting the file size of the video
delay 10
set isNow to size of (info for f)
-- this section is sampling the file size 30 seconds later
end repeat
tell application "Finder"
open theFile using application file "ProResSQ.app" of folder "Desktop" of folder "admin" of folder "Users" of startup disk
end tell
-- get next item f in thisFolder
end repeat
end adding folder items to
But unfortunately, this doesn’t work.
Sigh.
A