Sign in to follow this  
Followers 0
mycloutier

UIA Invoke click for a UIA_ListItemControlTypeId - Is that possible?

4 posts in this topic

#1 ·  Posted (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 ...

#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")

EndFunc

The 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 by mycloutier

Share this post


Link to post
Share on other sites



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?

Share this post


Link to post
Share on other sites

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?

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