I have written an apple script previously to automate a task I do in my work many times.
With Apple updating to Catalina I will lose the use of Quicktime 7 (which is part of my Image sequencing workflow) I want to take the opportunity rewrite my script.
I'm taking it one step at a time and the first is running FFmpeg.
I have written a script:
ffmpeg -r 25 -f image2 -pattern_type glob -i '*.JPG' -codec:v prores_ks -profile:v 0 imagemagick_TL_Test_01.mov
This works in Terminal if I navigate to the folder and run it. Great.
I now want to find a way to make the action drag and droppable.
I have tried to adapt my old code to include this at the relevant section to run the ffpmeg on the dropped folder but I have encountered error after error. Ideally renaming the output file to have the grandparent folder name and save in the parent folder.
on open dd
repeat with d in dd
set d to d's contents
tell application "Finder"
set seq1 to (d's file 1 as alias)
set dparent to d's container as alias
set mov to "" & dparent & (dparent's name) & ".mov"
end tell
do shell script "d=" & d's POSIX path's quoted form & "
/opt/local/bin/ffmpeg -r 25 -f image2 -i \"" & seq1 & "\" '*.JPG' -codec:v prores_ks -profile:v 0 \"" & dparent & ".mov\" && exit
"
end repeat
end open
This gives me the error :
[image2 @ 0x7ff9cd000000] Could find no file with path '***:Users:***:Desktop:imagemagick_TL_Test:01:_DAN7741.JPG' and index in the range 0-4
***:Users:***:Desktop:imagemagick_TL_Test:01:_DAN7741.JPG: No such file or directory
Any pointers would be greatly appreciated! Thank you!
Best Answer
An important consideration when programming is to come up with a plan for debugging your code. Here is how I would have coded the code for debugging.
It's difficult to debug an on open handler. I add an on run handler where I can dummie up the input to a common routine that is called by on run and on open. fyi: I corrected how the input was processed from on open.