Another total Applescript newbie, hope I can get some help here.
I’m trying to process folders of QT movies, creating 10-second clips of each one and saving to a new folder.
I can’t find the command set for QT Player anywhere. I’ve tried various combinations of terms to set duration or set selection start to 0 and set selection end to 300 and trim to selection (mimicking the manual operations), but to no avail.
Any hints?
Thanks
Model: MacBook Pro
AppleScript: 1.10.7
Browser: Firefox 2.0.0.14
Operating System: Mac OS X (10.4)
Give this a try, if it works for you then it’s just a matter of setting it up to loop through all your videos
-- Set Params
set new_duration to 10
tell application "Finder"
set theFile to choose file
set theMovie to name of theFile
set savePath to (choose folder) as Unicode text
end tell
tell application "QuickTime Player"
open theFile
select all theMovie
set the selection end of document theMovie to (new_duration * (time scale of document theMovie))
trim document theMovie
rewind document theMovie
save self contained document theMovie in file (savePath & theMovie)
close document theMovie
end tell
I’m glad it helped! In terms of the syntax AppleScript tries to be english-like, but that doesn’t always happen LOL
My recommendation is to take a look at the QuickTime Dictionary and then compare that to real world examples here… you’ll have it no time.
Okay to take this a step further there has been some discussion of the ruby appscript bridge on this board as well as some mailing lists I read. So since I was stuck on my train last night I figured I would dive into the topic. So without further ado here is the rb-appscript version of the code. (Warning - I have ZERO experience with Ruby so while this works on my end your mileage may vary)
[code]begin; require “rubygems”; rescue LoadError; end
require “appscript”; include Appscript
require “osax”; include OSAX
Set Duration Params
new_duration = 10
App Declarations
Finder = app(‘Finder’)
QT = app(‘QuickTime Player.app’)