2016-09-30 80 views
0

的UI擴展樹視圖是如下: enter image description here如何使用的AutoIt

工具「的AutoIt窗口信息」,只能找到紅色元素(紅色矩形區域),子項無法定位。 那麼如何擴展或操作這些項目?

+0

如果這是一個常見的TreeView32控件,您可以使用[ControlTreeView](https://www.autoitscript.com/autoit3/docs/functions/ControlTreeView.htm)函數。由於您的控件類是SysTreeView32,應該很有可能工作... – Samoth

回答

1

通常還可以使用按鍵訪問Windows控件。

在屏幕轉儲中選擇了Farmtt元素。那將是你的出發點。

你可以試試:

  • 發送( 「{} DOWN」)向下移動的元素。 (「{TAB}」)導航到下一個控件(按鈕,複選框等)
  • 發送(「{NumPadMult}」)遞歸地擴展SysTreeView32中的文件夾。
  • 發送( 「{ENTER}」)ENTER鍵主鍵盤

等上

參考:
https://www.autoitscript.com/autoit3/docs/appendix/SendKeys.htm

+1

如果在擴展節點時存在加載時間,則在樹中使用這些熱鍵可能會很麻煩。 – Trevor

0

有在這裏兩件事情: 1)使用以下代碼片段:

;Gets the handle for the text 
Func readFirstlevelTreeNodes($hWndCtrl) 
    Local $firstItemHandle = _GUICtrlTreeView_GetFirstItem ($hWndCtrl) 
    Local $iCount = _GUICtrlTreeView_GetSiblingCount($hWndCtrl, $firstItemHandle) 
    Dim $aRet[$iCount] 
    $aRet[0] = $firstItemHandle 
    For $index = 1 To $iCount - 1 
     $aRet[$index] = _GUICtrlTreeView_GetNextSibling ($hWndCtrl, $firstItemHandle) 
     $firstItemHandle = $aRet[$index] 
    Next 

    getTreeNodeTextList($hWndCtrl,$aRet) 
EndFunc 

; Gets the text for given sibling node handle lists 
Func getTreeNodeTextList($hWndCtrl,$aRet) 
    ConsoleWrite("Tree Node first level list"&@CRLF) 
    For $index = 0 To Ubound($aRet) -1 
     ConsoleWrite(_GUICtrlTreeView_GetText ($hWndCtrl, $aRet[$index])&@CRLF) 
    Next 
EndFunc 

您可能會看到fir st級樹節點。 2)如果你仍然看不到輸出,那麼請驗證控制手柄值和窗口句柄。如果他們是正確的,它仍然不會顯示第一級樹節點,然後嘗試以管理員身份運行您的sciTE編輯器。

我認爲這應該有所幫助。