7

I'm trying to find a way to make a python script that finds all the buttons/checkboxes inside an excel document and interacts with them randomly.

I've tried using pywinauto, but it doesn't find the actual objects inside the document (probably because it's a vb object and not a regular GUI).

How can it be done using python? Or maybe there's another way to do it?

Here is a file for example excel

Thanks.

cydan
  • 615
  • 5
  • 17

1 Answers1

2

Thanks for the sample! I'm afraid there is no nice way to obtain button or check box texts using pywinauto. Though Inspect.exe shows these controls but they all are just images! See the screenshot with Inspect.exe. So the only way to automate them is enumerating by index. Of course, you must use pywinauto.Application(backend="uia"). For random interaction the texts might not matter, but the texts would be very helpful for re-contructing the actions sequence in case of crash/error.

Another chance might be in win32com.client usage. Not sure Excel COM objects have necessary properties. Need to investigate separately.

Vasily Ryabov
  • 9,386
  • 6
  • 25
  • 78