Cannot tell Photoshop using a variable name

  1. This compiles:

set imageApp to "Adobe Photoshop CS5.1"
--tell application "Adobe Photoshop CS5.1"
tell application imageApp
	--set w to width of current document
	--display dialog w
end tell

BUT:

  1. If I uncomment the “set w to width of current document” line I get an “expected end of line but found class name” error.
  2. And if I then use the literal app name it compiles again.

So it compiles with a variable app name or a call for the current document, but not both.

Thanks for any explanation/workaround.
LK

Hi,

application tell blocks require a literal string argument to be able to evaluate the terminology.
Alternatively you could use a using terms from application block, but this requires a literal string argument, too


set imageApp to "Adobe Photoshop CS5.1"
tell application imageApp
	using terms from application "Adobe Photoshop CS5.1"
		set w to width of current document
		--display dialog w
		
	end using terms from
end tell