Telling an Application

I’ve never tried this before, but was rather surprised that it didn’t work when I just did so perhaps someone can chime in although I have a feeling I should know this one LOL

This WORKS

tell application "QuickTime Player"
	set sound volume of document 1 to 0
end tell

NEITHER of these work though

set QT to application "QuickTime Player"
tell QT
	set sound volume of document 1 to 0
end tell

set QT to "QuickTime Player"
tell application QT
	set sound volume of document 1 to 0
end tell

Hi James,

if you use a variable instead of a literal string to specify the application,
you have to wrap the crucial part with using terms from application.
The compiler needs this only at compile time to resolve the terminology


set QT to application "QuickTime Player"
tell QT
	using terms from application "QuickTime Player"
		set sound volume of document 1 to 0
	end using terms from
end tell

Interesting, thanks Stefan