Question

I want to do automatic installation by AutoIt. I cant activate and choose elements menu on the "select features" step. I can choose any element in the "tree". For it I use the function

ControlTreeView($windowId, "", $h_tree, "Select", "#2")

How to activate and choose the elements menu in ControlTreeView?

alt text

Was it helpful?

Solution 2

You can see answer on the question on the site 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)

OTHER TIPS

You can do it with the keyboard.

I have done this in the past with with

send("{down}{space}{down}{down}{enter}")

combination. I know this can't be the best way to do it but it will work.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top