#Include <GuiTreeView.au3>
#Include <WinAPI.au3>
$WinTitle = "窗口标题"
$ControlID = "控件ID"
$hWnd = ControlGetHandle($WinTitle, "", $ControlID )
$hItem = _GUICtrlTreeView_FindItem($hWnd, ControlTreeView($WinTitle, "", $ControlID, "GetText", "根项目|子项目 或用#0 #1 #3索引"))
Local $tRect = _GUICtrlTreeView_DisplayRectEx($hWnd, $hItem, True)
If @error Then Exit
Local $tPoint = _WinAPI_PointFromRect($tRect, True)
Local $iX, $iY
_WinAPI_GetXYFromPoint($tPoint, $iX, $iY)
ControlClick($WinTitle, "",$ControlID , "left", 2, $iX, $iY)
可以上面这样试试,这样没有鼠标过程。
如果不行应该有判断鼠标位置再用下面的方法模拟鼠标
#Include <GuiTreeView.au3>
#Include <WinAPI.au3>
$WinTitle = "窗口标题"
$ControlID = "控件ID"
$hWnd = ControlGetHandle($WinTitle, "", $ControlID )
$hItem = _GUICtrlTreeView_FindItem($hWnd, ControlTreeView($WinTitle, "", $ControlID, "GetText", "根项目|子项目 或用#0 #1 #3索引"))
_GUICtrlTreeView_ClickItem($hWnd, $hItem, "left", False, 2)
|