mycloutier Posted April 9, 2015 Share Posted April 9, 2015 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 Link to comment Share on other sites More sharing options...
junkew Posted April 10, 2015 Share Posted April 10, 2015 Your question is not completely clear but below an example how you can get a value of a name property (check UIAWrappers for all properties) local $name=_UIA_getPropertyValue($oUIElement, $UIA_NamePropertyId) FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
bowker Posted June 19, 2018 Share Posted June 19, 2018 @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) Link to comment Share on other sites More sharing options...
junkew Posted June 19, 2018 Share Posted June 19, 2018 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 Use simplespy to give you the base source code for testing on your element First try your element to highlight and "fix" the hierarchy Then change your action to: click, setvalue, setvalue using keys, ......... Tweak the code to speed up your code (worst case fallback to the raw interfaces instead of _UIA_Action($element, "youraction") FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
bowker Posted June 20, 2018 Share Posted June 20, 2018 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 Link to comment Share on other sites More sharing options...
junkew Posted June 20, 2018 Share Posted June 20, 2018 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. FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
bowker Posted June 21, 2018 Share Posted June 21, 2018 @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. Link to comment Share on other sites More sharing options...
junkew Posted June 21, 2018 Share Posted June 21, 2018 Search for func getpval with your editor FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
bowker Posted June 21, 2018 Share Posted June 21, 2018 (edited) I solved it using : Local $iMax = _UIA_getPropertyValue($oUIElement, $UIA_RangeValueMaximumPropertyId) Local $iMin = _UIA_getPropertyValue($oUIElement, $UIA_RangeValueMinimumPropertyId) sorry for that Edited June 21, 2018 by bowker I got it :D Link to comment Share on other sites More sharing options...
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