Home > OS >  How can i access the values of a StringGrid with pywinauto
How can i access the values of a StringGrid with pywinauto

Time:10-24

I have the following control identifiers. There is a StringGrid whose values I can not copy with right click or ctrl c which is why I would like to get its values with pywinauto. How can I access the values within the grid? This is how it looks like :

Pane with StringGrid

child_window(title="Werte bestimmter Wellenlängen", class_name="TWaveValue")
   |
   | Toolbar - 'ToolBar1'    (L593, T413, R1086, B453)
   | ['Toolbar', 'ToolBar1Toolbar', 'ToolBar1']
   | child_window(title="ToolBar1", class_name="TToolBar")
   |
   | TSAStringGrid - ''    (L593, T453, R1086, B660)
   | ['TSAStringGrid', 'Werte bestimmter WellenlängenTSAStringGrid']
   | child_window(class_name="TSAStringGrid")

CodePudding user response:

This is custom control that is not supported by pywinauto (and MS UI Automation API) by default. But the application developers can use DelphiUIAutomation to enable UI Automation capabilities on the application side. It means pywinauto will be able to automate TStringGrid. But it's usually hard to reach developers with such requests.

Alternative way is too complicated: DLL injection is needed to get internal properties of the grid from inside the application process. It's a separate research topic and a kind of reverse engineering.

  • Related