Jump to content

Need Help with List View.


Recommended Posts

Hello,

I need some help with Lists or ListView. Not sure which one. Here is what I need.

I want to open a console window(something like Windows Explorer). And Select a particular file or folder with its name/text. Eg. "Program Files". Is this do-able?

I have used ControlListView but have not had much success with it.

Thanks

Link to comment
Share on other sites

Welcome to Autoit, if I am not mistaken you want a File Dialog.

Function Reference

FileOpenDialog

--------------------------------------------------------------------------------

Initiates a Open File Dialog.

FileOpenDialog ( "title", "init dir", "filter" [, options [, "default name" [, hwnd]]] )

Parameters See Autoit helpfile.

Edited by athiwatc
Link to comment
Share on other sites

Two thoughts

1) Below might be the solution you are looking for.

2) Just shellexecute explorer.exe using parameters to get to a certain folder (see example below)

#Include <WinAPI.au3>

ShellExecute("explorer.exe","c:")
sleep(5000)
    $hwnd= WinGetHandle("[active]")
    $classed = _WinAPI_GetClassName($hwnd)
    local $var = "[CLASS:"&$classed&"]"
    if $var = "[CLASS:ExploreWClass]" or $var = "[CLASS:CabinetWClass]" Then
                    $sSelected_Path = ControlGetText($var, "", "Edit1")
                 ;   $CLVItem = ControlListView($var, "", "[CLASS:SysListView32; INSTANCE:1]", "GetSelected")

                ;   ToolTip($Item)
            for $i = 1 to ControlListView($var, "", "[CLASS:SysListView32; INSTANCE:1]", "GetItemCount")
                ;$CLVItem = ControlListView($var, "", "[CLASS:SysListView32; INSTANCE:1]", "GetSelected")
                $Item = ControlListView($var, "", "[CLASS:SysListView32; INSTANCE:1]", "GetText", $i)
                if $Item="Program Files" then 
                                ControlListView($var, "", "[CLASS:SysListView32; INSTANCE:1]", "Select",$i)
                                send("{enter}")
                                ExitLoop
                EndIf
            Next

    EndIf
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...