This is what I have so far:
on run
choose file with prompt "Please choose QuickTime movies whose timecode to modify" of type "public.movie" with multiple selections allowed without invisibles
open result
end run
on open droppedItems
set source_folder to choose folder with prompt "Please choose folder where to reference timecode from"
repeat with thisItem in droppedItems
tell application "QuickTime Player 7"
set themovie to open thisItem
set thetracks to tracks of document 1
repeat with thetrack in thetracks
if the kind of thetrack is "Timecode" then
copy thetrack
end if
end repeat
make new document with name
paste thetrack
end tell
end repeat
end open
The goal is to be able to pick a number of movie files and paste a specific track (in this case, the timecode track) from another movie with the same file name. I am stumped, however, at how to deal with individual tracks in QuickTIme via AppleScript. The code above results in an error saying that the copy message is not understood.
Any help would be greatly appreciated. Thanks in advance!
In order to copy/paste you have to select something first. The problem is that if you select something then that selection is made for every track of the movie. Therefore, in order to select only from the track you want you have to remove all of the other tracks from the movie first. Here’s an example. Suppose I wanted to copy the sound track from a movie and paste it into a new document…
set theMovie to (path to desktop as text) & "a.mov"
set trackName to "Sound Track"
tell application "QuickTime Player 7"
set m1 to open theMovie
tell m1
-- first we delete all of the other tracks from theMovie
-- we loop the tracks in reverse so the track numbers
-- do not get out of sync as we delete them
rewind
set theTracks to tracks
repeat with i from (count of theTracks) to 1 by -1
set thisTrack to item i of theTracks
if name of thisTrack is not trackName then
delete thisTrack
end if
end repeat
-- now we select and copy everything from theMovie so we can paste it
select all
copy
end tell
-- create a new movie and paste in the track
make new document
tell document 1
select all
paste
rewind
select at 0 to 0
end tell
-- close the original movie without saving
tell m1
close saving no
end tell
end tell