Jump to content

UIA Invoke click for a UIA_ListItemControlTypeId - Is that possible?


Recommended Posts

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...