s5vi Posted May 26, 2014 Posted May 26, 2014 hi please help, i would like to read text from WPF window Autoit info do not show any control or text Ranorexspy show the text text iuiautomation simplespy show this Mouse position is retrieved 782-436 At least we have an element [Please unlock the phone screen on your phone and click "Retry" (ErrorCode:0xC)][TextBlock] Having the following values for all properties: Title is: <Please unlock the phone screen on your phone and click "Retry" (ErrorCode:0xC)> Class := <TextBlock> controltype:= <UIA_TextControlTypeId> ,<50020> , (0000C364) *** Parent Information *** Title is: <Windows Phone Developer Registration> Class := <Window> controltype:= <UIA_WindowControlTypeId> ,<50032> , (0000C370) how can i read that text from my autoit script ?
junkew Posted May 26, 2014 Posted May 26, 2014 should be obvious when you read the spy source or check some of the examples on iuiautomation please post some code to see you are at least trying FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets
s5vi Posted May 27, 2014 Author Posted May 27, 2014 Thanks Junkew With this code i can read text, if i set coordinates. ( i moved the window to 0,0 ) fortunately coords are fixed in app _UIA_Init() Local $tStruct = DllStructCreate($tagPOINT) ; Create a structure that defines the point to be checked. Global $UIA_oUIAutomation ;The main library core CUI automation reference Global $UIA_oUIElement, $UIA_pUIElement ;Used frequently to get an element DllStructSetData($tStruct, "x", 200) DllStructSetData($tStruct, "y", 281) $UIA_oUIAutomation.ElementFromPoint($tStruct,$UIA_pUIElement ) $oUIElement = objcreateinterface($UIA_pUIElement,$sIID_IUIAutomationElement, $dtagIUIAutomationElement) If IsObj($oUIElement) Then ConsoleWrite(_UIA_getPropertyValue($oUIElement, $UIA_NamePropertyId) & @CRLF) Endif
junkew Posted May 27, 2014 Posted May 27, 2014 example 11 should help you out (download examples of uiautomation thread) But basically you first find your main window (to limit the number of elements to search) Please check the examples.zip for latest syntax (example 4 and 11 should help you out) $oNotepad=_UIA_getFirstObjectOfElement($UIA_oDesktop,"class:=Notepad", $treescope_children) if isobj($oCalc) Then get the element you want to do something with based on the properties $sText="Bewerken" ;Edit $oUIElement=_UIA_getFirstObjectOfElement($oCalc,"name:=" & $sText, $treescope_subtree) get the property value you are interested in _UIA_getPropertyValue($oUIElement,$UIA_NamePropertyId) FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now