Sign in to follow this  
Followers 0
mycloutier

UIA_TextControlTypeID condition

2 posts in this topic

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



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  
Followers 0