Jump to content
Sign in to follow this  
s5vi

read text from WPF window

Recommended Posts

s5vi

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 ?
 

Share this post


Link to post
Share on other sites
s5vi
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

Share this post


Link to post
Share on other sites
junkew

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)

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.