Imagine we have a button and have set a target on it.
The following two scripts will do exactly the same thing:
on click
tell target to set "text-color" to "red"
end click
and
on click
tell target to tell target to set "text-color" to "red"
end click
which in my view is counter-intuitive. The reason for this is that target is interpreted in the context of the underlying script, which in this case the on click handler above. And this is true for any target in the script, even if it is an object specifier of a context switching tell command, is interpreted in the original context.
Main Points
I'll illustrate this issue with an example:
Imagine we have a button and have set a target on it.
The following two scripts will do exactly the same thing:
and
which in my view is counter-intuitive. The reason for this is that
target
is interpreted in the context of the underlying script, which in this case theon click
handler above. And this is true for anytarget
in the script, even if it is an object specifier of a context switching tell command, is interpreted in the original context.