Help, can't get simple script to get video data rate in Xcode

Hello,

I have started an Applescript droplet application project in Xcode. Just in case, I have added the Quicktime and QTKit framework (I’ve also tried it without them), but this simple script always bombs out with the error:

“QuickTime Player got an error: Can’t make data rate into type reference. (-1700)”

Xcode 2.3, Quicktime Pro 7.04, 10.4.7

Here is the code:



on idle
	(* Add any idle time processing here. *)
end idle

on open bigMovie
	
	tell application "QuickTime Player"
		activate
		open bigMovie
		get data rate
		
	end tell
	
end open


The alternate version below gives this slightly more verbose error:

Can’t get «class ddra» of {alias “My Disk:Users:Me:Desktop:mymovie.mov”}. (-1728)



on idle
	(* Add any idle time processing here. *)
end idle

on open bigMovie
	
	tell application "QuickTime Player"
		activate
		open bigMovie
		set bigMovieDataRate to data rate of bigMovie
		display dialog bigMovieDataRate
		
	end tell
	
end open



I’m kind of mystified – in 10.3 and Quicktime 6 this got a data rate from the same movie without a problem. I get the same results just using Script Editor, but it’s Xcode I’m really concerned with. Many thanks in advance for any assistance!

Model: Powerbook G4
AppleScript: Xcode 2.3
Browser: Camino 1.02
Operating System: Mac OS X (10.4)

I think in your script is a ‘of movie …’ missing:

on open bigMovie
   
   tell application "QuickTime Player"
       activate
       open bigMovie
       get data rate of movie 1 -- for the frontmost movie
       
   end tell
   
end open

or - to be absolutely sure that nobody has opened an other movie before you ask for it’s rate - maybe like this:

on open bigMovie
   
   tell application "QuickTime Player"
       activate
       open bigMovie
       get data rate of (first movie whose original file is (bigMovie as string))
   end tell
   
end open

Awesome, that did it. Thanks Dominik!