Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the '10.6: Use AppleScript for precise trimming in QuickTime X' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.6: Use AppleScript for precise trimming in QuickTime X
Authored by: mrmobius on Mar 11, '10 05:51:16AM

Thanks to all who replied to my hint. I love what one can do with Apple Script. I am just not good with scripting or any programming languages.

Mr. Apple Script: I tried your script under 10.6.2 with the same movie I've been using to test this. I ended up with 1 minute segments and a lot of system alert beeps during the process. Also, the script did an export not a save as which took longer.

What I did was a manual process. I would open the movie, enter my start and stop time in the script and run the script. Then I would do a save as and name the movie clip. The save as was very quick, way quicker than an export in my testing. I think the save as is just making a trimmed version with zero decompression of the audio or video. I would then hit Undo, and enter in the next start and stop times to create the next ten minute clip.

It would be amazing to have a script that asked for the movie file, asked for the base name, desired clip length, and then segmented the entire movie with using Save As until the end of the movie. You could call it Bread Slicer or something and sell it for a buck or two. I would be the first in line to purchase.

[ Reply to This | # ]
10.6: Use AppleScript for precise trimming in QuickTime X
Authored by: philostein on Mar 12, '10 04:52:50AM
I think the beeps were mine. 'Save as…' - genius! Ah, the power of constructive criticism. I've re-written the PhilHints version of mr. applescripts' script and saved it in the same place:
mr applescript's QuickTime Player script PhilHints branch.scpt
It contains most of the ideas you were thinking of.

It will overwrite old files if the new ones have the same name. It seems to work on audio files too. Remember, the segmenting code is still mr. applescript's.
Cheers, PhilHints.

[ Reply to This | # ]
10.6: Use AppleScript for precise trimming in QuickTime X
Authored by: lwein on Mar 07, '13 06:04:55AM

Hello there,
I'm new to Applescript and I randomly found your script doing almost exactly what I need.

Actually I'm asked to write a script that runs in command line with four arguments. The name of the file to trim, the start time of the trim, the end time of the trim and the name of the file under which to be saved.

Reusing your "mr applescript's QuickTime Player script PhilHints branch", I feel I'm not too far far from the result.
The problem is that I get a strange error: "QuickTime Player got an error: Can't make file " into type integer"

Here is the code at this time:

on run argv
set fileName to POSIX file (get item 1 of argv)
set start_trim to item 2 of argv
set end_trim to item 3 of argv
set resultName to item 4 of argv

log start_trim
log end_trim

tell application "Finder"
open file fileName using application file "QuickTime" of folder "Applications" of startup disk
end tell

---This runs the app

tell application "QuickTime Player"
trim document fileName from start_trim to end_trim
save document fileName in file resultName
close document fileName without saving
display dialog "Movie segmented" buttons {"OK"} default button "OK" giving up after 2

on error a number b
display dialog a
end try
end tell

end try

end run

Could someone help me please?

[ Reply to This | # ]