I’ve been looking into scripting a droplet in applescript where i can drop a bunch of videos on the app, get a dialog box, and convert the files with different settings (mainly resolution, gamma, rotation) based on user input via the dialog. The encoded files should be placed in a folder called “mp4” in the source dir.
How would i go ahead and set the dropped files as a variable to feed into the ffmpeg “-i” switch?
How do i retrieve the directory of the source files to run makedir in that folder?
Thanks in advance. Any pointers would be greatly appreciated.
on open theSel
set theFolder to first item of theSel
# Here, theFolder is an alias
set posFolder to POSIX path of theFolder
# Here posFolder is an unix path
# To use it in a shell script command it would be good to quote it
set qposFolder to quoted form of posFolder
# add the required code here.
end open
For safe, I add that you must save this code as an application to use it.
Yvan KOENIG (VALLAURIS, France) mardi 13 janvier 2015 17:26:05
Here is how to retrieve the source folder of an alias. (I belive a droplet is passed a list of aliases.)
set myDesktopPathAsAlias to path to desktop
# just to have an alias that I know will work
tell application "Finder"
set parentPath to container of myDesktopPathAsAlias as alias
end tell