mycloutier Posted July 19, 2015 Share Posted July 19, 2015 (edited) Have been playing around with UIAWrappers for a bit now and I am facing a challenge when trying to select a specific item in a combo box. I am able to select the combo box item as long as it is visible in the drop down menu. There are 34 different items in the combo box but only 5 are visible in the drop down menu without scrolling down the list ... This is the code I have so far ...expandcollapse popup#include "UIAWrappers1.au3" #include <MsgBoxConstants.au3> #include <File.au3> #include <FileConstants.au3> Local $oP10 Local $oP9 Local $oP8 Local $oP7 Local $oP6 Local $oP5 Local $oP4 Local $oP3 Local $oP2 Local $oP1 Local $oP0 Local $oUIElement Local $COMPORT= "COM7" AutoItSetOption("MustDeclareVars", 1) ShellExecute("C:\CampSilv\CAMPCuSv.bat") WinWait("SilverScreen") Sleep (5000) Call("InvokeCOM") Func InvokeCOM() IF Not WinActive("{CLASS:}", "SilverScreen") Then WinActivate("{CLASS:}", "SilverScreen") Local $oP6=_UIA_getObjectByFindAll($UIA_oDesktop, "Title:=SilverScreen;controltype:=UIA_WindowControlTypeId;class:=", $treescope_children) _UIA_Action($oP6,"setfocus") Local $oP5=_UIA_getObjectByFindAll($oP6, "Title:=MOSS Setup(Version Feb 2013);controltype:=UIA_WindowControlTypeId;class:=#32770", $treescope_children) _UIA_Action($oP5,"setfocus") Local $oP4=_UIA_getObjectByFindAll($oP5, "Title:=Setup;controltype:=UIA_ButtonControlTypeId", $treescope_children) _UIA_Action($oP4,"setfocus") _UIA_Action($oP3,"invoke") Local $oP3=_UIA_getObjectByFindAll($UIA_oDesktop, "Title:=SilverScreen;controltype:=UIA_WindowControlTypeId;class:=", $treescope_children) Local $oP2=_UIA_getObjectByFindAll($oP3, "Title:=Survey import[C:\CAMPSILV\DRW\];controltype:=UIA_WindowControlTypeId;class:=#32770", $treescope_children) _UIA_Action($oP2,"setfocus") Local $oP1=_UIA_getObjectByFindAll($oP2, "Title:=Data Source:;controltype:=UIA_ComboBoxControlTypeId;class:=ComboBox", $treescope_children) _UIA_Action($oP1,"setfocus") _UIA_Action($oP1,"click") Local $oP0=_UIA_getObjectByFindAll($oP1, "Title:=Data Source:;controltype:=UIA_ListControlTypeId;class:=ComboLBox", $treescope_subtree) _UIA_action($oP0,"highlight") Local $oUIElement=_UIA_getObjectByFindAll($oP0, "Title:=COM7;ControlType:=UIA_ListItemControlTypeId", $treescope_subtree) _UIA_action($oUIElement,"highlight") _UIA_action($oUIElement,"click") EndFuncThe default item selected varies and changes all the time. Is there a way to click an item without having to scroll down the list?Any ideas or help would be greatly appreciated! Thank you! Edited July 19, 2015 by mycloutier Link to comment Share on other sites More sharing options...
junkew Posted July 19, 2015 Share Posted July 19, 2015 (edited) Not sure but study example 18. I normally scroll till item is visible. If invoke or click is possible you can see with inspect.exe of windows sdk tools. Edited July 19, 2015 by junkew mycloutier 1 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...
mycloutier Posted July 19, 2015 Author Share Posted July 19, 2015 I am able to click the desired item as long as it is visible ... inspect says false under IsInvokePatternAvailable. Is there a way to scroll to the desired item list according to its title? Link to comment Share on other sites More sharing options...
mycloutier Posted July 20, 2015 Author Share Posted July 20, 2015 If a desired listitem IsOffscreen the value should be set to true ... is there a way to change this value to false in order to make it on screen thus making it available to click? 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