Jump to content
mycloutier

UIA_TextControlTypeID condition

Recommended Posts

mycloutier

Hello,

I am encountering a specific situation using UIAWrappers.au3. I am able to focus on my element. I want my script to execute certain actions depending on certain conditions .... 

The only variable that will be changing in this situation is the title ... control type will always be the same ... 

I want msg boxes to be displayed depending on the different titles of the controltypeid's. Here is my code so far ... Any ideas on how to code this would be greatly appreciated :-)

 

#include "UIAWrappers1.au3"
#include <MsgBoxConstants.au3>
AutoItSetOption("MustDeclareVars", 1)
 
#AutoIt3Wrapper_UseX64=N  ;Should be used for stuff like tagpoint having right struct etc. when running on a 64 bits os
 
; Run
ShellExecute("mobsync.exe")
 
; Wait 2 seconds for windows explorer to appear.
WinWait("Sync Center")
 
IF Not WinActive("{CLASS:CabinetWClass}", "Sync Center") Then WinActivate("{CLASS:CabinetWClass}", "Sync Center")
 
Local $oP7=_UIA_getObjectByFindAll($UIA_oDesktop, "Title:=Sync Center;controltype:=UIA_WindowControlTypeId;class:=CabinetWClass", $treescope_children)
_UIA_Action($oP7,"setfocus")
Local $oP6=_UIA_getObjectByFindAll($oP7, "Title:=Sync Center;controltype:=UIA_PaneControlTypeId;class:=ShellTabWindowClass", $treescope_children)
_UIA_Action($oP6,"setfocus")
Local $oP5=_UIA_getObjectByFindAll($oP6, "Title:=;controltype:=UIA_PaneControlTypeId;class:=DUIViewWndClassName", $treescope_children)
_UIA_Action($oP5,"setfocus")
Local $oP4=_UIA_getObjectByFindAll($oP5, "Title:=Shell Folder View;controltype:=UIA_PaneControlTypeId;class:=DUIListView", $treescope_children)
_UIA_Action($oP4,"setfocus")
Local $oP3=_UIA_getObjectByFindAll($oP4, "Title:=Folder View;controltype:=UIA_ListControlTypeId;class:=SysListView32", $treescope_children)
_UIA_Action($oP3,"setfocus")
Local $oP2=_UIA_getObjectByFindAll($oP3, "Title:=Folders (1);controltype:=UIA_GroupControlTypeId;class:=", $treescope_children)
_UIA_Action($oP2,"setfocus")
Local $oP1=_UIA_getObjectByFindAll($oP2, "title:=Offline Files;ControlType:=UIA_ListItemControlTypeId", $treescope_subtree)
_UIA_action($oP1,"setfocus")
 
Local $oUIElement=_UIA_getObjectByFindAll($oP1, "title:=Disconnected;ControlType:=UIA_TextControlTypeId", $treescope_subtree)
Local $oUIElement2=_UIA_getObjectByFindAll($oP1, "title:=Sync in progress;ControlType:=UIA_TextControlTypeId", $treescope_subtree)
 
If Local $oUIElement=_UIA_getObjectByFindAll($oP1, "title:=Disconnected;ControlType:=UIA_TextControlTypeId", $treescope_subtree) Then
   _UIA_action($oUIElement,"setfocus")
   MsgBox(0, "Warning!", "Disconnected from the network!", 10)
 
ElseIf Local $oUIElement2=_UIA_getObjectByFindAll($oP1, "title:=Sync in progress;ControlType:=UIA_TextControlTypeId", $treescope_subtree) Then
   _UIA_action($oUIElement,"setfocus")
   MsgBox(0, "Warning!", "Sync is already in progress!", 10)
 
Elseif $MsgBox = MsgBox(0, "Warning!", "Sync is already in progress!", 10)
 
EndIF

Share this post


Link to post
Share on other sites
bowker

@junkew is there a way for you to set the value of elements that you get using the 

On ‎4‎/‎10‎/‎2015 at 2:19 PM, junkew said:

local $name=_UIA_getPropertyValue($oUIElement, $UIA_NamePropertyId)

 

Share this post


Link to post
Share on other sites
junkew

yes, however I do not understand the relation with getting a name property value that will not find you the element

First post has all actions you can do including setvalue, setvalue using keys, sendkeys, ......

So flow is

  1. Use simplespy to give you the base source code for testing on your element
  2. First try your element to highlight and "fix" the hierarchy
  3. Then change your action to: click, setvalue, setvalue using keys, .........
  4. Tweak the code to speed up your code (worst case fallback to the raw interfaces instead of _UIA_Action($element, "youraction")

 

Share this post


Link to post
Share on other sites
bowker

so for example I want to set the value of a slider using left or right arrow.
I can get the value of slider with

 

_UIA_action($oUIElement,"setfocus")
$strText = _UIA_getPropertyValue($oUIElement, $UIA_LegacyIAccessibleValuePropertyId)

is it possible to use the returned value of $strText as a number on how many left and right arrows I will send?

P.S: Sorry for bringing up a 3 year old thread :sweating:

Share this post


Link to post
Share on other sites
junkew

most likely you need a rangevalue pattern

see https://msdn.microsoft.com/en-us/library/windows/desktop/ee671644(v=vs.85).aspx for documentation and details. I am not a slidercontrol expert

First check with inspect.exe what you can see. Read FAQ31 if you want to find inspect.exe. Not sure if simplespy will give you directly the property value of interes.

Share this post


Link to post
Share on other sites
bowker

@junkew what does getPval do? it says it's an underfined function when I run the code.
 

ConsoleWrite("  We did get for UIA_RangeValueMaximumPropertyId : " & getPVal($oUIElement, $UIA_RangeValueMaximumPropertyId) & @CRLF);Maximum value in the range.
 ConsoleWrite("  We did get for UIA_RangeValueMinimumPropertyId : " & getPVal($oUIElement, $UIA_RangeValueMinimumPropertyId) & @CRLF);Minimum value in the range.

 

Share this post


Link to post
Share on other sites
bowker
Posted (edited)

I solved it using :

Local $iMax = _UIA_getPropertyValue($oUIElement, $UIA_RangeValueMaximumPropertyId)
    Local $iMin = _UIA_getPropertyValue($oUIElement, $UIA_RangeValueMinimumPropertyId)

sorry for that :D

Edited by bowker
I got it :D

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

×