Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

physaux

macrumors newbie
Original poster
Feb 11, 2010
7
0
Hey guys, this is in reference to my other thread. I think I have narrowed down the problem. Anyways, here is the code:

Code:
tell application "QuickTime Player"
trim document 1 from 0 to 2
end tell
Could somebody please try that and tell me if you can compile it?
When I try I get the following error:
Code:
Expected end of line, etc. but found "from"

I am using 'Script Editor'- Here is the version Data:
http://img692.imageshack.us/img692/8130/picture3qf.png
And I have Mac OS X 10.5.8

What is wrong here??:confused::confused:
 
try setting the movie document properties selection start and selection end first, then issue the trim command, by itself. Something like this (dunno if this would work exactly):

Code:
tell application "QuickTime Player"
	tell document 1
		set selection start to 0
		set selection end to 2
		trim
	end tell
end tell
 
I tried that, and it compiled properly. But it did not run properly.. I think I just need to upgrade to snow leopard.. :(
 
Weird, I just tried it and it seems to work, and I am on Leopard 10.5.8 as well. What I did find out, though, is that the values you use for the time depend on the "time scale" the movie uses. In my case the movie was 29.97 frames per second, and in this case QuickTime uses a time scale of 2997 units per second. For your example using the values 0 and 2, that would not work out well, since it'd be much less than one frame of any common video format. You need to get the time scale from the movie first. So if I want to trim off the first two seconds and the last three seconds of the movie, this works:

Code:
tell application "QuickTime Player"
	tell document 1
		set timeScale to time scale
		set selection start to (timeScale * 2)
		set selection end to (duration - (timeScale * 3))
		trim
	end tell
end tell
 
omg amazing I am so happy thank you :)
It is working now, yesssssssss :):):)

I restarted my laptop and now it works fine :)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.