user1858143
user1858143

Reputation:

Simulate key press

I'm creating a program for mac and I need to simulate key presses but I don't know how to simulate a key press. I have done it on windows using winapi, but not on xcode. How would I go about doing that? (Using xcode on mac 10.7 creating a command line application)

Upvotes: 0

Views: 1248

Answers (1)

Matthias
Matthias

Reputation: 8180

You should generate a key event by keyEventWithType:location:modifierFlags:timestamp:windowNumber:context:characters:charactersIgnoringModifiers:isARepeat:keyCode: and send it to NSApplication by sendEvent:.

Upvotes: 1

Related Questions