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

Hi, I am trying to write a little script that will automate the running of MAME in a randomised jukebox fashion, where a rom will run on demo mode for a set time then a new random game is loaded.

Everything like the randomisation, process spawning, timing and killing of processes is no problem. However, the main issue is that MAME asks you to "Press any key" to run a loaded rom. I've been trying to search for a way to interact with this Win32 app to send a key signal via the script - is there ayn possible way to do such a thing? Many thanks
  • Comment on How do I send keyboard input to currently running Win32 apps?

Replies are listed 'Best First'.
Re: How do I send keyboard input to currently running Win32 apps?
by Moonie (Friar) on Jun 05, 2002 at 23:04 UTC
    Sounds like you may want to use Win32::Setupsup - which can be found at http://Jenda.Krynicky.cz.
    - Moon
      Thanks, looks like just the thing I need! Now I only have to get to grips with using it :-)
Re: How do I send keyboard input to currently running Win32 apps?
by kodo (Hermit) on Jun 06, 2002 at 06:56 UTC
    Hi Tosh,
    I had the same problem some time ago and I used Win32::GuiTest. It worked really well, the module also got some other nice features and is easy to install.

    giant
      Thanks for the tip!

      I've played around a little with the Win32::Setupsup module and it seemed to do the kind of thing I wanted but with infrequent results. Some keys don't seem to send at all and the usage frequently locks up the keyboard so I have to randomly hit keys to try to get my own input back. Maybe this is because I am a fairly inexperienced Perl coder and i'm just being stupid :-) However, it is something to bear in mind for others using the module.

      On the other hand, has anyone got any tips on using the module (above and beyond reading the module docs)? Many thanks.