I am newbie in cocoa. I am working on a GUI for a shell app. I am using AMShellWrapper class, and it works fine.
The problem is that my shell app has a dialog requests a keystroke to continue. I’m pretty lost at this point. I’ve tried CGEventCreateKeyboardEvent but may not be the right way.
Anyone know how I can send a keystroke to a shell app that was initiated by my wrapper?
You can create a
pty(4)pseudo-terminal in which to run the application. This allows your application to be the “master” (thinkTerminal.app) which runs the “slave” program (thinkbash(1)) and provides mechanisms to control the slave.This is a pretty involved area of Unix programming; I strongly recommend reading the source for the
pty.cprogram in the sourcecode for the Advanced Programming in the Unix Environment, 2nd edition book. (The source code would make a lot more sense if read with the companion chapter in the book.)You could probably use the
pty.cprogram unchanged and supply a ‘driver’ for it to drive your client program, which would simplify the task.