Jump to content
Visual Boy Advance-M

automation via pywinauto

Recommended Posts



I'm brand new here so I appreciate your patience with my ignorance.


I find that when playing games I perform some tasks very repetitively, and wish that I could automate them so that the computer can do it for me. I like Python and have used pywinauto to automate applications before. However when I try to automate button presses in VBA-M it does not work. When I try to SendKeys (Pywinauto has a thin wrapper around it called TypeKeys) to various panels/objects (I'm not experienced with wx), says that either "the control is not enabled" or it does nothing.


I have also tried it on a previous version, VBA-M878, no luck there either. There is only one panel/object there, and when I SendKeys/TypeKeys nothing happens.


So I'm wondering if anybody has any suggestions on how I can programmatically send keystrokes to the emulator application such that they are recognized as button presses in the game. I'm a confident programmer, so if it's not in Python then I can probably still handle it.



Let me add a little more info: I *can* activate keyboard shortcuts using TypeKeys (when I send 'Ctrl+w' the game closes), but I can't activate buttonpresses (when I send 'x' then it doesn't press the [a] button, even though it is mapped as such). Anybody know why this would be, and how I can get around it?


I was thinking that a potential solution would be to add definable "macros" in the emulator which could be activated via hotkeys. For example, I could define a macro that performs a combo attack (say [down],

, ), and whenever I press Ctrl+Alt+1 it executes that macro. Then I could automate the setup of macros (pywinauto handles windows/popups/dialogs with no problems, for example to open the game I have it press Alt+o then type in the full name of the ROM) and also automate the execution of macros (since keyboard shortcuts seem to work). Of course this would require additional functionality to be built in to the emulator, which I don't want to impose since the developers are probably overloaded already. So it is preferable to instead understand why simple buttonpresses are not working.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now