I'm writing an Applescript, and distributing it to many different people. What I want it to do is go through the actions normally, but if the "C" key is held down, it goes to the config window. I'm running Mac Os 10.7.5, normal Applescript. What I have so far is:
tell application "System Events" try if keystroke "C" is down then beep 5 end if on error end try end tell
It compiles and runs, but doesn't react when I press the "C" key, even when I set it to endlessly repeat. Is there a working version of this?
The System Events keystroke command is for sending keystrokes, not receiving or looking for key presses. Regular AppleScript is not really designed for things like this, so you will need to use other tools. There is a shell script to check for modifier keys (for example, look for the option key instead of the C key) - take a look at this MacScripter post.