Jump to content

UIA - Fetch Data Help


Recommended Posts


Hello ,

I am trying to fetch data and control a Windows Program.
The data isn't reflected in the Au3Info tool , hence used SimpleSpy UIA , for trying.

The code is able to fetch only one row at a time.
Most Strangely , the code doesn't retreive the same specified row consistently.
If I run the same code , under same circumstance , it is still fetching different rows.
This was when op2 and op3 were zero. I would not like to use this at all.


Also , it takes 3 seconds for it search down the hiearchy and reach the row.
I will need to fetch ALL the rows continuously for 6 hours every second , in a minimized state.

Can you please help.

Attached :
1. AuInfo summary
2. Code
3. Simple Spy Summary

The Actions I am trying to do (in a Minimzed State - not affecting usage of computer for other purposes)
1. Fetch all Rows (number of rows will not always be constant
2. Press the Check box for a specific row(s)
3. Press the squareOff button on top

Thanks a lot

 

 

#include <MsgBoxConstants.au3>
#include "UIAWrappers.au3"
AutoItSetOption("MustDeclareVars", 1)

Local $oP8=_UIA_getObjectByFindAll($UIA_oDesktop, "Title:=MO Trader;controltype:=UIA_WindowControlTypeId;class:=WindowsForms10.Window.8.app.0.3e799b_r8_ad1", $treescope_children)
_UIA_Action($oP8,"setfocus")
Local $oP7=_UIA_getObjectByFindAll($oP8, "Title:=;controltype:=UIA_PaneControlTypeId;class:=WindowsForms10.Window.8.app.0.3e799b_r8_ad1", $treescope_children)
_UIA_Action($oP7,"setfocus")
Local $oP6=_UIA_getObjectByFindAll($oP7, "Title:=;controltype:=UIA_PaneControlTypeId;class:=WindowsForms10.Window.8.app.0.3e799b_r8_ad1", $treescope_children)
_UIA_Action($oP6,"setfocus")
Local $oP5=_UIA_getObjectByFindAll($oP6, "Title:=;controltype:=UIA_PaneControlTypeId;class:=WindowsForms10.Window.8.app.0.3e799b_r8_ad1", $treescope_children)
_UIA_Action($oP5,"setfocus")
Local $oP4=_UIA_getObjectByFindAll($oP5, "Title:=Day Net Position;controltype:=UIA_PaneControlTypeId;class:=WindowsForms10.Window.8.app.0.3e799b_r8_ad1", $treescope_children)
_UIA_Action($oP4,"setfocus")
Local $oP3=_UIA_getObjectByFindAll($oP4, "Title:=;controltype:=UIA_PaneControlTypeId;class:=WindowsForms10.Window.8.app.0.3e799b_r8_ad1", $treescope_children)
_UIA_Action($oP3,"setfocus")
Local $oP2=_UIA_getObjectByFindAll($oP3, "Title:=0.0000;controltype:=UIA_PaneControlTypeId;class:=WindowsForms10.Window.8.app.0.3e799b_r8_ad1", $treescope_children)
_UIA_Action($oP2,"setfocus")
Local $oP1=_UIA_getObjectByFindAll($oP2, "Title:=0.0000;controltype:=UIA_TableControlTypeId;class:=WindowsForms10.Window.8.app.0.3e799b_r8_ad1", $treescope_children)
_UIA_Action($oP1,"setfocus")
Local $oP0=_UIA_getObjectByFindAll($oP1, "Title:=Data Panel;controltype:=UIA_CustomControlTypeId;class:=", $treescope_children)
;~ First find the object in the parent before you can do something



Local $oUIElement=_UIA_getObjectByFindAll($oP0, "title:=Row 12;ControlType:=UIA_CustomControlTypeId", $treescope_subtree)
_UIA_action($oUIElement,"click")

Local $string = _UIA_action($oUIElement,"getValue")
MsgBox($MB_OK,"", $string)



Local $oUIElement2=_UIA_getObjectByFindAll($oP0, "title:=Row 6;ControlType:=UIA_CustomControlTypeId", $treescope_subtree)
_UIA_action($oUIElement2,"click")

Local $string2 = _UIA_action($oUIElement2,"getValue")
MsgBox($MB_OK,"", $string2)

 

Screenshot 2.png

Screenshot.png

SimpleSpy Row.txt

Link to comment
Share on other sites

Whats most strange is how the same code , returns different results when repeatedly run.
Also , in one instance I was able to get all the rows together - which is what is the desired end result.
This despite SimplySpy not showing it together as such. Maybe I didnt understand that it was possible.

 

Screenshot 3.png

Screenshot 4.png

Link to comment
Share on other sites

@junkew , Can you please help.
Is it possible to fetch all the rows at once while the window is minimized.

Why is the code returning varied results and sometimes even autoit code snippets when run multiple times ?
Is there some clearing/dumping of data which has to be mandatorily carried out ?

Link to comment
Share on other sites

Minimized most of the times its not possible.

Sometimes it helps to move window to bottom right.

Simplespy will not see all but

  • check out one of the @LarsJ posts he has written some excellent tools examples for uia
  • Check the examples.zip in my examples thread

There are many reasons things can fail but it looks like its finding incorrect object. Its hard to help on applications where we do not have acces to. Make sure you understand tree hierarchy which is shown in inspect.exe

If you look in the wrapper udf you can see i maitain a reference array with rti references as some kind of caching. You could clean this array as sometimes it gets polluted.

 

Edited by junkew
Link to comment
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
 Share

×
×
  • Create New...