Sign in to follow this  
Followers 0
RyanR

SysTreeView32

4 posts in this topic

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

post-26035-1186772681_thumb.jpg

Share this post


Link to post
Share on other sites



#2 ·  Posted (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:

#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 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

Share this post


Link to post
Share on other sites

#3 ·  Posted (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:

#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 by BRUNOYORK

Share this post


Link to post
Share on other sites

Hi, It work fine for me just replacing ";Title:C:\" to ";Title:Local Disk (C:)"

Eduardo.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0