From: Joel VanderWerf Date: 2010-06-16T07:39:04+09:00 Subject: Re: Simulating keystrokes for automated user input Ryan Mohr wrote: > I've written a simple console app (type command. get results. repeat.) > and I'm looking for a way to send it simulated keystrokes (hoping to > remotely send commands through a socket connection and have them "typed" > in the main console). I thought the solution would be easy but I'm > finding it much harder than anticipated. > > The solution needs to generate a keystroke programmatically such that > the console has no idea whether it was physically typed by the user or > not. > > Tried writing to a modified stdin, directly editing /dev/tty, redirected > echos... no luck yet. What about ruby's PTY lib? PTY.spawn 'your-app' do |r,w,cid| ... end