I have a project where I need to do two things: 1) create a reference movie of a file that will be name file#####.mov (where the # will be some kind of number) and It needs to pick only the first file of a continuous sequence (ie. If a folder has a series of sequential files (with some breaks in the sequence), it would make a reference file for the first frame of each break. So, the folder has mm0001 through mm0100 and mm0200 through mm1300, the script should result in two reference movies: mm0001.mov and mm0200.mov).
Can anyone point me in the right direction because I’m not having much luck with the reference movie creation?
Thanks.
This script seemed to work in the limited testing I was able to do. Let me know if it works for you =)
set _sourceF to choose folder with prompt "Please Select Your Source Movie Folder"
set _targetF to (choose folder with prompt "Please Select Your Target Movie Folder") as string
set _prefix to text returned of (display dialog "Please enter the movie prefix" & return & "(example: mm in mm0100.mov)" default answer "")
set _prefix to (count of _prefix) + 1
tell application "Finder"
try
set _movies to (every file of _sourceF whose name extension is "mov") as alias list
on error
set _movies to (every file of _sourceF whose name extension is "mov") as alias as list
end try
set _current to missing value
repeat with a_movie in _movies
set _name to text _prefix through -5 of ((name of a_movie) as string)
if _current is equal to missing value or (_name as integer) > ((_current as integer) + 1) then
set _current to _name
my make_reference(a_movie, _current, _targetF)
else
set _current to _name
end if
end repeat
end tell
on make_reference(a_movie, _current, _targetF)
tell application "QuickTime Player"
open a_movie
save front movie in (_targetF & "file" & _current & ".mov") as reference
close front movie without saving
end tell
end make_reference
Cheers!
That worked very well so far.
Awesome.