detecting keystrokes

hi, I am in the need of detecting keystrokes with an applescript, i have no idea how to do this but the code should look like this:

if keystroke is equal to “k”
display dialog “You just pressed the letter K”
end if
end repeat

any idea in how to do this will be great!



vanilla AppleScript is not able to detect keystrokes.
An application written in AppleScriptObjC could do that.

ok! thank you :frowning: