2 Replies Latest reply: Dec 28, 2013 3:09 PM by Apple_For_The_Win
Apple_For_The_Win Level 1 Level 1

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"
                              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?

Solved by Apple_For_The_Win on Dec 28, 2013 3:09 PM Solved
To answer my own question, I now use Cocoa-Applescript in Xcode and add keystroke shortcuts through it's menu.
Reply by red_menace on Apr 10, 2013 7:24 AM Helpful
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.

All replies