Hello, this is my first week with applescript and programming in general. I’m learning applescript to automate some mundane parts of my job so I can focus on more interesting work. Although I’ve walked through a tutorial series on Lynda.com and some of the educational posts here, I find that the best way I really learn is by jumping into things.
So, I’ve started working on a script that will automate the process of taking video files from camera sd, CF and XDCam cards, renaming them and ingesting them for editing. I’ve got a few bits of the script to work, but I feel like I’m getting stuck when it comes to referencing the files that are dropped on the application and then manipulating those files in the script. Just to give you an idea of the script, I want the user to be able to drop a camera card over a droplet and then the droplet asks them for information about the video. That information is used to create a file name that I then use to create a .zip of the camera card (with that file name) After that I wanted to sift through the camera card folders and find the video files. (Camera’s often have many layers of hierarchy in their cards where the video file is deep down inside there). I want to name the video files using info from the queries and then I want to copy the video files to a watch folder on the desktop that will get sucked up into Adobe Media encoder. Any advice is appreciated. Not sure if this is too long of a piece of code to post but I figured I’d give it a try.
-- I want to have someone take a camera card and drag it over the droplet.
property movieFiles : {"mov", "m4v", "MXF", "mp4"}
on open these_items
(choose from list {"SHOW_A", "SHOW_B", "SHOW_C"} ¬
with prompt "What is the Show Title?")
set showtitle to result as text
display dialog "Short Description" default answer "EnterShortDescriptionHere"
set shortdescription to text returned of result
display dialog "Date" default answer "MMDDYY"
set dateofclip to text returned of result
display dialog "Camera Letter?" default answer "CamA"
set cameraletter to text returned of result
(choose from list {"INT", "MASTER", "HOST", "SHOOT"} ¬
with prompt "Category")
set category to result as text
global cardName
set cardName to showtitle & "_" & shortdescription & "_" & dateofclip & "_" & cameraletter & "_" & category
display dialog cardName
-- Create a Backup of the Card
tell application "Finder"
make new folder at (path to desktop) with properties {name:(cardName as string) & "_CardBackup"}
set cardBackupPath to (path to desktop as string) & (cardName as string) & "_CardBackup" as string as alias
set theItem to these_items
set itemPath to quoted form of POSIX path of theItem
set fileName to cardName
set theFolder to POSIX path of (container of theItem as alias)
set zipFile to quoted form of (theFolder & fileName & ".zip")
do shell script "zip -r " & zipFile & " " & "Macintosh HD:Users:myself:Desktop:CardBackups"
end tell
-- Parse out the media files from the card and send to a watchfolder
repeat with aFile in these_items
tell application "System Events"
if name extension of aFile is in movieFiles then
move aFile to "Macintosh HD:Users:myself:Desktop:Watchfolder"
end if
end tell
end repeat
end open