Shell scripts/commands in AppleScript are handled with the do shell script
command, which executes a shell script using the sh
shell. In the short form of:
do shell script "..."
Where ...
is the shell script to execute.
See AppleScript Language Guide do shell script
Commands Reference and Technical Note TN2065 do shell script
in AppleScript, for additional details.
What you need to do, is escape the double-quotes with a backslash, e.g. \"$f\"
and elsewhere as necessary.
I've tested your command, wrapped in a do shell script
command, with the necessary escaping as shown in the command below and it worked without issue.
do shell script "cd /Volumes/MEDIAS/WORK/CONVERSION_VIDEO/PROXY_720P/INPUT/; for f in *.mov *.mp4; do ffmpeg -i \"$f\" -vcodec prores -profile:v 0 -s 1280x720 /Volumes/MEDIAS/WORK/CONVERSION_VIDEO/PROXY_720P/OUTPUT/\"${f%.*}_PROXY_720P.mov\" && rm \"$f\"; done"
Note: Because the do shell script
command uses the sh
shell, if the ffmpeg
executable is not in the PATH
passed to the shell, which is /usr/bin:/bin:/usr/sbin:/sbin
, you'll need to include the fully qualified pathname to the ffmpeg
executable for your command to work in AppleScript.
f
. What error are you getting and what specifically would you like to know? – Allan Dec 21 '16 at 22:21