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

This is a sort of complicated problem, but probably has a really easy solution! So please bear with me.

I'm trying to write a program in windows so that no matter what window is active, a certain key or series of keystrokes will be output to that active window. For instance, this program is running in the background so when I have microsoft word open I could have the letter H be pushed every 10 seconds, but then I switch windows to notepad and every 10 seconds h is still being pushed. I need to be able to select a window and have the keystrokes output.

The purpose of this program is to help automate some work that needs to be done, and it's a lot easier than getting 16 of the little birds like from the simpsons to literally push the keys!

I've only programmed a chat bot in perl so my experience is a little limited, but a friend said I should try perl to see if it could do what I need. I just thought you guys know what's going on, so why not see if you had any ideas.

Just even a step in the right direction would be greately appreciated. Thanks a ton!

Alan

Replies are listed 'Best First'.
Re: Keystroke output help needed!
by BrowserUk (Patriarch) on Apr 15, 2003 at 05:08 UTC

    The sendkeys() function from Win32::GUITest seems tailor-made for your needs.


    Examine what is said, not who speaks.
    1) When a distinguished but elderly scientist states that something is possible, he is almost certainly right. When he states that something is impossible, he is very probably wrong.
    2) The only way of discovering the limits of the possible is to venture a little way past them into the impossible
    3) Any sufficiently advanced technology is indistinguishable from magic.
    Arthur C. Clarke.