I’m trying to write a drop folder action where each file is run by a Compressor Droplet. For what ever reason, my script file does not appear to be called by finder! Any help would be appreciated
-- Droplet watch folder script
on adding folder items to this_folder after receiving added_items
display dialog "hello" -- it doesnt even get here!!!!
set the_droplet to the application file "MyDroplet.app" of this_folder
repeat with the_video in added_items
--Ensure video is fully there before continuing
set previous_size to 0
set current_size to 1
repeat while previous_size ≠current_size
set previous_size to the size of (info for the_video)
delay 10
set current_size to the size of (info for the_video)
end repeat
-- The file should be done...
-- Load the video on to the droplet...
tell application "Finder" to open the_video using the_droplet
end repeat
end adding folder items to
your script (at least the display dialog line) works fine on my machine with leopard
I did:
¢ put the script into /Library/Scripts/Folder Action Script
¢ enable folder actions
¢ attach the script to the hot folder
¢ add a file manually to the folder
I’m new to apple script so I kind of need help seeing if this is viable
I will replace chess with my droplet.
on adding folder items to this_folder after receiving added_items
set the_droplet to the application file "Chess.app" of this_folder -- is this viable?
I get an error and it drops out on the second line.
Any ideas?
I’m trying to make it simple for the droplets to do this
tell application "Finder" to open the_video using the_droplet
It looks like you just need a tell the finder to do this set the_droplet to the application file “Chess.app” of this_folder – is this viable?
Also I have shown a better way of debugging with speech (say) rather than display.
In this example set debug_mode to true or false to get
-- Droplet watch folder script
on adding folder items to this_folder after receiving added_items
set debug_mode to true
if debug_mode is true then say "on adding, check"
tell application "Finder" to set the_droplet to the application file "chess.app" of this_folder
if debug_mode is true then say "set the droplet check"
repeat with the_video in added_items
if debug_mode is true then say 1
--Ensure video is fully there before continuing
set previous_size to 0
set current_size to 1
if debug_mode is true then say 2
repeat while previous_size ≠current_size
if debug_mode is true then say 3
set previous_size to the size of (info for the_video)
delay 10
set current_size to the size of (info for the_video)
end repeat
-- The file should be done...
-- Load the video on to the droplet...
tell application "Finder" to open the_video using the_droplet
end repeat
end adding folder items to