I am very new to Applescript but have been on Macs for nearly 20 years. I need to automate opening a folder of QuickTime movies and exporting them all with the same export settings to Flash video (FLV) files.
set afile to choose file
set dt to path to desktop as Unicode text
set outfile to dt & "test.flv"
tell application "QuickTime Player"
activate
open afile
export movie 1 as {class:"FLV1"} using most recent settings to outfile
end tell
but I get the error “can’t make “FLV1” into a type class”
You need to create a quicktime settings file. The settings file holds all your export settings. Here’s directions to make one.
a) Open a file in QuickTime
b) Choose “Export” from the “File” menu
c) Select the desired export kind from the “Export:” popup menu
d) Click the “Options…” button to specify your custom settings, then click OK
e) Note that the “Use:” popup menu now displays “Most Recent Settings”
f) Start the export by clicking on the “Save” button (if you don’t start an export the “Most Recent Settings” won’t stick)
g) Cancel the export if it is a long one
h) To double-check the export settings, select the “Export…” menu item again and check them
i) Without closing the open movie, run the following AppleScript and set the path to where you want the settings file saved
set exportSettingsPath to (path to desktop folder as Unicode text) & "ExportSettings"
tell application "QuickTime Player"
tell first document
save export settings for QuickTime movie to file exportSettingsPath
end tell
end tell
Then you can encode the file with this. Note that quicktime 7.2 broke some of the “save” options from within applescript, so I’m not sure if the “export” command still works.
set theMovie to choose file
set exportMovieName to "newMovie"
set exportMovieFolder to path to desktop folder as Unicode text
set exportSettingsPath to (path to desktop folder as Unicode text) & "ExportSettings"
tell application "QuickTime Player"
open theMovie
tell first document
export to (exportMovieFolder & exportMovieName) as QuickTime movie using settings exportSettingsPath
end tell
end tell
Yes, I understand. In this line… save export settings for QuickTime movie to file exportSettingsPath… you need to find the right wording and exchange that with the “as quicktime movie” part. I was really just trying to show you what how to go about the rest of the process. I wrote mostly to show you about the settings file and the code necessary to use it. I’m sorry but I can’t help you with the specific code for the FLV encoding.
I think it’s all of the “save” variations too. I tried 3 or 4 different variations using save, and none worked for me. I haven’t tried the “export” option though, as I’m usually not trying to re-encode something. Normally I’m just putting files that were in other container formats into a quicktime container so I can do other things like add chapter markers, text tracks, annotations etc.