automation via pywinauto

Post Reply
fffrune
Junior Member
Posts: 2
Joined: Wed Nov 16, 2016 3:50 pm

automation via pywinauto

Post by fffrune »

Hello,

 

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.

 

Thanks!


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.

Last edited by fffrune on Thu Nov 17, 2016 11:32 am, edited 1 time in total.
Post Reply