Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

stejano

macrumors newbie
Original poster
Sep 6, 2008
1
0
Hi,
This is my first thread! I'm Stejano and I hope I can help you and you can help me.
Then...
I want to try to simulate an event key of a pression of key of my keyboard.
I've found how to "read" the pression of a button (NSEvent) but I don't find how simulate the pression of a keyboard's key.
How can I do?I use cocoa.

Thanks!
 
I don't know of a way you can do that directly in Cocoa if you mean a true simulation of the user pressing a key anywhere in an app. You could maybe fake it by constructing and sending keyboard events to whichever view/window the user has active (like the current "key" window). Of course that will only work inside your own application, not in another or in the Finder. You might also be able to use AppleScript to do it.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.