Hello,
I have a project that is bending my mind.
I have a folder action script that currently works pretty well to launch a Compressor Droplet. It is 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 "DVCPROHD1080i.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 DVCPROHD1080i.app in the script above is the Compressor droplet.
So, that’s nice. The Droplet has some handy things built into it, like how I want the file named, where I want it to save the compressed file and what compression Cluster to use.
The drawback of this process is that Compressor is always brought to the foreground each time the droplet is invoked. In my workflow, I have thousands of files I need to compress, and so this script causes Compressor to come to the foreground every 30 seconds, interrupting the work I am doing. I need this to happen in the background.
So question #1: Can a droplet be invoked in the background? Basically hide the whole process?
I don’t know of a way to do that. So, some folks have advised me to look at the command line version of Compressor. So, this does indeed do the work in the background, but it is more complicated and beyond my talents, at least at this point in my AppleScript knowledge.
So, the Command line for a Compressor job goes like this:
./Compressor -clusterid tcp://127.0.0.1:51737 -batchname myBatch -jobpath /Volumes/SourceLocation/ClipToCompress.mov -settingpath /Users/TheUsersName/Library/Application\ Support/Compressor/TheSettingYouWant/setting -destinationpath /Users/DestinationFolder/theCompressedFileName.mov
So, the hitch in this command is:
The clusterid (in this same tcp://127.0.0.1:51737) will change from computer to computer (perhaps cluster to cluster is more accurate). The port is assigned dynamically.
To get to proper cluster id, you need to do this in the terminal. First navigate to the Compressor command line elements inside Compressor.app/Contents/MacOS and then type ./Compressor -show. The result is something like this:
001-739-711:/Applications/Compressor.app/Contents/MacOS anton$ ./Compressor -show
2007-05-10 10:00:01.131 Compressor[2549] in ShowCluster for tcp://127.0.0.1:52645
2007-05-10 10:00:01.131 Compressor[2549] in ShowCluster created URL
2007-05-10 10:00:01.131 Compressor[2549] in ShowCluster created user client
2007-05-10 10:00:01.131 Compressor[2549] in ShowCluster created got accesskey
2007-05-10 10:00:01.133 Compressor[2549] in ShowCluster connected to user client
2007-05-10 10:00:01.134 Compressor[2549]
There may be more than one cluster, you may have a cluster of multiple computers to speed up the compression.
So, how do I get this folder action script working so that the file that gets dropped onto the folder gets sent to the command line version of Compressor, that the script discovers the clusterid and then compressed with the SAME NAME but to a different folder.
Any ideas?
Thanks.