AppleScript can only resolve the terminology of a particular application,
if this application is specified with the keyword application and a literal string like
tell application "Terminal"
To resolve an application’s terminology specified by a variable use a using terms from block
set appname to "Terminal"
using terms from application "Terminal"
tell application appname
tell front window
get size
end tell
end tell
end using terms from
tell application "Terminal"
get size of front window
end tell
Return the same result as this?
get size of front window of application "Terminal"
The former returns the window size, the latter returns the font size.
I’m guessing it’s the same problem – the terminology can’t be resolved because the context of “Terminal” is lost by the time the result from “front window” is returned. If I encapsulate the second example above with ‘using terms from app “Terminal”’ I do indeed get the window size.
I view this as a serious limitation to the language because the code must explicitly state the full specifier of each object in order to reliably query it. I think this means I can’t write a generic method to operate on any window independent of the application to which it belongs.
Am I missing something?
It seems to me that if I have a handle on an object, say a window, I should be able to get its size without having to specify that it’s a Terminal window.
terminology will only be resolved, if the code is in a application tell block, the of form doesn’t work
But you can use a tell command also in an one-liner
tell application "Terminal" to get size of front window
A window belongs always to an application respectively to an application process