Select QuickTime app depending on OS version?

Is there a way to select the QuickTime Player application based on the OS version?

I’m writing a script to set the timing of slides that go along with a recorded lecture. I’m using QuickTIme Player to open a movie of the lecture and jpeg images of the slides. Since the latest version of QuickTIme Player in OS X 10.6 is not scriptable, I need to call the older version, but in 10.5 I just want to call the standard version.

I thought that this would work:


if (system version of (system info)) < "10.6" then
	set QuickTimeApp to "QuickTime Player"
else
	set QuickTimeApp to "QuickTime Player 7"
end if

try
	tell application QuickTimeApp
		open item 1 of slideImageFiles as alias
		set controller type of document slideTitle to none
	end tell
end try

but I get a syntax error “A identifier can’t go after this identifier.” on the set controller… command when trying to compile on a Mac running 10.5.8.

By the way, this does work:


if (system version of (system info)) < "10.6" then
	set QuickTimeApp to "QuickTime Player"
else
	set QuickTimeApp to "QuickTime Player 7"
end if

try
	tell application "QuickTime Player"
		open item 1 of slideImageFiles as alias
		set controller type of document slideTitle to none
	end tell
end try

Thanks for any suggestions,
Bob

Model: MacBook Pro
AppleScript: 2.0.1
Browser: Safari 531.22.7
Operating System: Mac OS X (10.5)

Are you getting the error at compile time, or at run time?
If it’s at compile time, you could save your original script to a plain text file, request its contents via an other AppleScript and run the contents:

property scriptTXT : "Macintosh HD:Users:username:desktop:file.txt"

set myScript to (read alias scriptTXT) as text
run script myScript

Hope it helps,
ief2

The error occurs, because AppleScript cannot resolve terminology specified in a variable.
It’s required either to write tell application “literal string” or
to use the using terms from application “literal string” block


try
	using terms from application "QuickTime Player"
		tell application QuickTimeApp
			open item 1 of slideImageFiles as alias
			set controller type of document slideTitle to none
		end tell
	end using terms from
end try

I recommend to write separate code for 10.5 and 10.6