Can someone show an example on how to create an NSEvent that simulates pressing return?
You should take a look at the NSEvent Class Reference, and more specifically, -keyEventWithType:location:modifierFlags:timestamp:windowNumber:context:characters:charactersIgnoringModifiers:isARepeat:keyCode:
.
From there, it shouldn't be difficult. Construct all the necessary components, and send the event using NSApplication
's -sendEvent:
method.