RyanR Posted August 10, 2007 Posted August 10, 2007 I somewhat new to AutoIt, just been messing around with it to see what it can do. I'm trying to use it to do some checks and automate the configuration of a program. One of the checks i need to do requires it to check what the AutoIt v3 Window Info program calls a SysTreeView32 Is there any simple way of having it check for a specified value in one of the items of the tree? or even simply outputting the whole tree into a text file or .ini file. Ryan p.s. - attaching a captured image of the Control tab in window info in case that helps
PsaltyDS Posted August 11, 2007 Posted August 11, 2007 (edited) The classic example of a SysTreeView32 is the folder pane of the Explorer window. Here's a demo using PaulIA's AutoIt Library and the A3LTreeView UDF: expandcollapse popup#include <A3LTreeView.au3> Opt("WinTitleMatchMode", 4) HotKeySet("{ESC}", "_Quit") ; Get an explorer window open to C:\ If WinExists('[CLASS:ExploreWClass;Title:C:\]') Then $hWin = WinGetHandle('[CLASS:ExploreWClass;Title:C:\]') Else If Not WinExists('[CLASS:CabinetWClass;Title:C:\]') Then Run("Explorer.exe C:\") WinWait('[CLASS:CabinetWClass;Title:C:\]') EndIf $hWin = WinGetHandle('[CLASS:CabinetWClass;Title:C:\]') EndIf WinActivate($hWin) WinWaitActive($hWin) ; Create folder view (SysTreeView321) if required $hSTV1 = ControlGetHandle($hWin, "", "[CLASS:SysTreeView32;INSTANCE:1]") ; Folder explorer control If $hSTV1 = "" Then ControlSend($hWin, "", "", "!v") ; View ControlSend($hWin, "", "", "e") ; Explorer ControlSend($hWin, "", "", "o") ; Folder Sleep(100) $hSTV1 = ControlGetHandle($hWin, "", "[CLASS:SysTreeView32;INSTANCE:1]") ; Folder explorer control EndIf ; Read current SysTreeView321 selected text to console $hNode = "" While WinExists($hWin) $hSelection = _TreeView_GetSelection ($hSTV1) If $hSelection <> $hNode Then $hNode = $hSelection $sText = _TreeView_GetText ($hSTV1, $hNode) ConsoleWrite("Debug: $sText = " & $sText & @LF) EndIf Sleep(100) WEnd Func _Quit() Exit EndFunc ;==>_Quit Edited August 11, 2007 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
BRUNOYORK Posted August 14, 2007 Posted August 14, 2007 (edited) The classic example of a SysTreeView32 is the folder pane of the Explorer window. Here's a demo using PaulIA's AutoIt Library and the A3LTreeView UDF: expandcollapse popup#include <A3LTreeView.au3> Opt("WinTitleMatchMode", 4) HotKeySet("{ESC}", "_Quit") ; Get an explorer window open to C:\ If WinExists('[CLASS:ExploreWClass;Title:C:\]') Then $hWin = WinGetHandle('[CLASS:ExploreWClass;Title:C:\]') Else If Not WinExists('[CLASS:CabinetWClass;Title:C:\]') Then Run("Explorer.exe C:\") WinWait('[CLASS:CabinetWClass;Title:C:\]') EndIf $hWin = WinGetHandle('[CLASS:CabinetWClass;Title:C:\]') EndIf WinActivate($hWin) WinWaitActive($hWin) ; Create folder view (SysTreeView321) if required $hSTV1 = ControlGetHandle($hWin, "", "[CLASS:SysTreeView32;INSTANCE:1]") ; Folder explorer control If $hSTV1 = "" Then ControlSend($hWin, "", "", "!v") ; View ControlSend($hWin, "", "", "e") ; Explorer ControlSend($hWin, "", "", "o") ; Folder Sleep(100) $hSTV1 = ControlGetHandle($hWin, "", "[CLASS:SysTreeView32;INSTANCE:1]") ; Folder explorer control EndIf ; Read current SysTreeView321 selected text to console $hNode = "" While WinExists($hWin) $hSelection = _TreeView_GetSelection ($hSTV1) If $hSelection <> $hNode Then $hNode = $hSelection $sText = _TreeView_GetText ($hSTV1, $hNode) ConsoleWrite("Debug: $sText = " & $sText & @LF) EndIf Sleep(100) WEnd Func _Quit() Exit EndFunc ;==>_Quit Tks, and i try this one. it's only open a explor with C driver then it's waiting...not sure why... i think it stops at here: WinWait('[CLASS:CabinetWClass;Title:C:\]') Edited August 14, 2007 by BRUNOYORK
Eduardo Posted August 14, 2007 Posted August 14, 2007 Hi, It work fine for me just replacing ";Title:C:\" to ";Title:Local Disk (C:)" Eduardo.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now