It seems useful to open another thread, just so more people might see it and add to their toolbox.
In a stack with a button and two fields, in the button script:
Code: Select all
on mouseUp
put "" into fld 2
keyDetector
end mouseUp
on keyDetector
if the commandKey is down then exit keyDetector --manually exit
put the keysDown into fld 1
if the keysDown = 120 then --detects "X"
put "X detected!" into fld 2 -- your routine here
exit keyDetector
end if
send "keyDetector" to me in 1
end keyDetector
Craig Newman