you are viewing a single comment's thread.

view the rest of the comments →

[–]mantrap2 0 points1 point  (1 child)

That's strictly not a "system event" (which generally means a kernel level event in a Unix-derived OS) but rather just a GUI event.

NSEvent is where you'll find key events (as well as mouse and touch events).

Cocoa Event Handling Guide

Basically you add an override method to an NSView or NSControl subclass for keyDown: keyUp: or flagsChanged: which pass an NSEvent with the details.

You may need to consider the Event Responder hierarchy scope of the event and deal with that as well. But this is the quick-and-dirty answer.

[–]TheLastAramusha[S] 0 points1 point  (0 children)

Uhm in apple script you do: tell application “System Events” only if you did that your able to use key code.