I am not quite sure what you are asking here. The script listed in post #9 makes one call to Extra Suites per loop iteration. If you want the script to check the current state of the keyboard for each loop iteration, the script must make a call to Extra Suites for each iteration. The return value from ES keys down is just an AppleScript list of zero or more AppleScript strings. The items in that list will never change unless your script changes them. Extra Suites is no longer involved by the time the if statement is executed. To get a new value the script has to make another call to Extra Suites.
If you are bothered by saving a value in a variable and then use that variable in only one place, you can eliminate the kd variable from the script if you like:
repeat 10 times
tell application "Extra Suites" to ES keys down
if result contains "command" then
exit repeat
else
say "nothing pressed"
end if
delay 1
end repeat
Also, it looks like Extra Suites has a way to test just for the command key, if that is all you are actually interested in:
repeat 10 times
tell application "Extra Suites" to ES command down
if result then
exit repeat
else
say "command not pressed"
end if
delay 1
end repeat
If you are concerned with the tell command, you can play around with the scope of the tell block, however it is my opinion that, in general, the smaller the tell block the better. Things can get confusing when OSAXen and/or applications have similar dictionary entries. If you keep the scope of the tell blocks as small as possible, it limits potential problems.
Here the entire if statement is in the scope of the tell to Extra Suites:
repeat 10 times
tell application "Extra Suites"
if ES command down then
exit repeat
else
say "command not pressed"
end if
end tell
delay 1
end repeat
Here the whole loop in the in the scope of the tell to Extra Suites:
tell application "Extra Suites"
repeat 10 times
if ES command down then
exit repeat
else
say "command not pressed"
end if
delay 1
end repeat
end tell
These arrangement of the tell block/statement do not affect how many keyboard related calls are made to the Extra Suites application, mostly it affects how the text of the script is compiled (actually in this case, the say command is affected to, but in a mostly harmless way).
Yes, that is what the Applescript button produces when you click it without any text selected. You should paste the text of your script in between those tags (the point between the adjacent close bracket and opening bracket).
The easiest way to see what the post text is supposed to look like for linked scripts is to click on the Quote link at the bottom of a post that has such a working AppleScript link. You can click this link to see post #9 from this thread. When you are done looking at the quoted post text and how the tags work, just click Go back, or press the back button in your browser, or close the tab/window (as long as you do not click Submit you will not create a new post).
Basically, you just need to put
before the start of your script text and
after the end of your script text. One way is to paste your script text into the post, then select it and click the Applescript button above the smilies. Or you can click the Applescript button with nothing selected, move the cursor to the point between the two newly inserted tags and then paste your script text. Or you can just type the open bracket, a, p, p, l, e, s, c, r, i, p, t, close bracket, then paste or type the text of your script, and finally type open bracket, slash, a, p, p, l, e, s, c, r, i, p, t, close bracket.