AutoIt: Activar y elegir elementos de menú de contexto en ControlTreeView
-
27-09-2019 - |
Pregunta
Quiero hacer la instalación automática de AutoIt. No puedo activar y seleccione el menú de elementos en el paso "Seleccionar funciones". Puedo elegir cualquier elemento en el "árbol". Para ello utilizo la función
ControlTreeView($windowId, "", $h_tree, "Select", "#2")
Cómo activar y elegir el menú de elementos en ControlTreeView?
Solución 2
Se puede ver la respuesta de la pregunta en el sitio http://forum.oszone.net /thread-146460.html
#include <GuiMenu.au3>
#include <GuiTreeView.au3>
#Include <SendMessage.au3>
#Include <WindowsConstants.au3>
$WinTitle= "1С:Предприятие 8.1"
$WinText = "Выберите компоненты программы"
WinWait($WinTitle, $WinText)
; ищем элемент окна и последовательно нужный пункт списка
$hDTCtrl = ControlGetHandle($WinTitle, "", "SysTreeView321")
$hDTItem = _GUICtrlTreeView_FindItem($hDTCtrl, "Дополнительные интерфейсы")
$hDTIt_1 = _GUICtrlTreeView_FindItem($hDTCtrl, "Казахский", False, $hDTItem)
; активируем окно
WinActivate($WinTitle, $WinText)
WinWaitActive($WinTitle, $WinText)
; переходим к нужному пункту списка
_GUICtrlTreeView_SelectItem($hDTCtrl, $hDTIt_1, $TVGN_FIRSTVISIBLE)
_GUICtrlTreeView_ClickItem ($hDTCtrl, $hDTIt_1, "left", True)
; вызываем контекстное меню
$aRect = _GUICtrlTreeView_DisplayRect($hDTCtrl, $hDTIt_1, True)
ControlClick($WinTitle, $WinText, $hDTCtrl, "left", 1, $aRect[0]-10, $aRect[1]+5)
WinWait("[CLASS:#32768]")
; выбираем нужный пункт контекстного меню
$hWnd = WinGetHandle("[CLASS:#32768]")
$hMenu = _SendMessage($hWnd, $MN_GETHMENU, 0, 0)
$aRect = _GUICtrlMenu_GetItemRect($hWnd, $hMenu, 0)
MouseClick("left", $aRect[0]+20, $aRect[1]+15, 1, 1)
Otros consejos
Puede hacerlo con el teclado.
he hecho esto en el pasado con la
send("{down}{space}{down}{down}{enter}")
combinación. Sé que esto no puede ser la mejor manera de hacerlo pero va a trabajar.
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow