Here’s an AppleScript I use at work: its a file that when folders are dropped onto it, the images inside are opened up as an image sequence in QuickTime, made into movies, and then saved.
It it not really ready to be used by anyone (you’ll have to modify some paths, filenames, etc) but I just wanted to get this up and maybe I’ll fix it up later for more general purpose use.
This took me forever to make because I didn’t understand the QuickTime AppleScript Dictionary.
on open folderNames
repeat with i from 1 to length of folderNames
tell application "QuickTime Player"
set compath to (POSIX path of item i of folderNames)
(*tell application "Script Editor"
display dialog compath
end tell*)
set documentObj to open image sequence (compath & "frame0.jpg") frames per second 30
(**)
set a to compath
set e to (offset of "/" in a)
set a to ((items (e + 1) thru ((((length of a)))) of a as text))
set e to ""
repeat while not e = ((length of a) + 1)
set e to (offset of "/" in a)
if e = ((length of a)) then
exit repeat
end if
set a to ((items (e + 1) thru ((length of a)) of a as text))
end repeat
(**)
set ending to a
(* ending means folder name *)
set basepath to (items (0 + 1) thru ((offset of (ending as text) in compath) - 1)) of compath as text
set foldername to (items 1 thru ((length of ending) - 1)) of ending as text
#tell application "Script Editor"
# display dialog foldername & ".mov"
#end tell
set (name of documentObj) to (foldername & ".mov")
save self contained documentObj in (basepath & foldername & ".mov")
#tell application "Script Editor"
# display dialog basepath & foldername & ".mov"
# end tell
close
end tell
end repeat
display dialog "All Movies Saved - Quitting..."
tell application "QuickTime Player"
quit
end tell
end open
Day 2: Actual Programming
Day 2. I already ditched that old chapter 3 link that I was using in Day 1 for the AppleScript Language Guide (PDF). This is going to be a run-through of all types of basic information you need to know in order to script in AppleScript.
And I’ll admit Day 1′s post was boring but basics are essential. Sorry about that.
Identifier
Identifier is basically a name for classes, variables, etc. It must begin with a letter and must be made from the following characters:
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_
Not case-sensitive so if
myNameis used first and thenMynameis used, then while the script is compiling,Mynamewill be changed tomyName.Exception: Place vertical bars (| – the button above the enter key) around the identifier to contain any characters. Every other time you use/call the identifier, include the vertical bars.
Read More »