maxl90 has asked for the wisdom of the Perl Monks concerning the following question:

I'm looking to execute a keyboard command without actually using the keyboard. Does anyone know how to do this? I know you can capture a keyboard command but can it be simulated? Thanks a lot guys. I knew if anyone knew it was possible it would be here. -Jeff

Replies are listed 'Best First'.
Re: Keyboard command
by jasonk (Parson) on Mar 14, 2003 at 15:24 UTC

    This is much more a question about your operating system than about perl, if your operating system provides a means for you to do this, then you can do it with perl.


    We're not surrounded, we're in a target-rich environment!
      Well i'm operating in qnx which is very close to linix. Would you just use the system command to do this? And how would you call it? If you know how to call a generic keyboard input then i can figure out how to manipulate it to suit my own needs. Thanks. -Jeff
Re: Keyboard command
by crenz (Priest) on Mar 14, 2003 at 16:00 UTC

    You'll have to tell us where you want to send the commands. Do you want to sent them to the OS or to an application? (and even that is a very rough way of describing it...)

    If you want to send keystrokes to an application (window), you will probably have to find out how to

    • Get the handle of the frame/window you want to send the keystrokes to
    • Send keyboard messages to that frame

    I would know more about how to do it on Windows, but I don't know enough about QNX/Neutrino to help you here, sorry.

Re: Keyboard command
by zentara (Cardinal) on Mar 15, 2003 at 13:26 UTC