Hi Richard,
When QuickTime trims the file, it creates an unsaved copy in an untitled window, and leaves the original untouched. Saving this untitled window via a script has given me all sorts of grief - it has to be exported. So to give the impression of trimming, saving and closing, you have to do something like this:
set srcFolder to choose folder
set fileList to list foldersrcFolder without invisibles
set folder_string to srcFolder as text
repeat with f in fileList
set file_path to folder_string & f
tell application "QuickTime Player"
activate
openfilefile_path
set startTrim to 7
set endTrim to duration of document 1
trimdocument 1 fromstartTrimtoendTrim
tell application "Finder" to delete file file_path
exportdocument 1 infile_pathusing settings preset "720p"
closedocument 1 without saving
end tell
end repeat
This opens the files, trims them, uses Finder to delete the original, exports the untitled document into the folder with the same name as the original, then closes the still-open "untitled" document without saving. You have to use a settings preset when you export. I've arbitrarily used 720p, the options are here:
I'm not sure if this is the only, or even the best, way of doing it. You may end up with an export dialog still working away for a few seconds after the last movie has closed. It does not preserve the file creation dates of the original movies. But I think it does what you want to do.
I strongly suggest that you test the above script on copies - do not use original movies that you value or cherish, or that belong to a client. Make absolutely sure that the script does what you want it to do before you incorporate it into a workflow. I will not be held responsible if you lose data as a result of running it.
Cheers,
H