Tell QuickTime Player

If I have the following statements:


tell application "QuickTime Player"
	close every window
	open file currentPath
	set the position of the front window to {394, 24}
end tell

This works OK, but If I have these statements:


property moviePlayer : "QuickTime Player"

tell application moviePlayer
	close every window
	open file currentPath
	set the position of the front window to {394, 24}
	end tell

Then I get this error on the last line (set the position of…)


QuickTime Player got an error:  Unknown object type (-1731)

In my opinion these statement should do exactly the same

Does anyone know why this error appears and what can be done about it.

Thanks in advance,

John

You should add a “using terms” statement:

property moviePlayer : "QuickTime Player"

using terms from application "QuickTime Player"
	tell application moviePlayer
		-- statements here
	end tell
end using terms from

Since in your code you are not targetting QT explicitly at compile-time, most probably the script compiles an osax’s “position” property, instead of QT’s one (eg, 24U Appearance) → compiles ‘posn’ instead of ‘ppos’