Sign in to follow this  
Followers 0
damon

help with exploring files

14 posts in this topic

Let me start by saying that I am having a block. I have done this in the past and do not remember how.

Down to business, I need to be able to see a directory of computer files in a listbox or treeview that my user can use to search for the appropriate directory.

I have searched and I must be typing in the wrong words for the searches. any help would be appreciated.

thanks,

damon


It always amazes me how one little thing can cause so much havoc

Share this post


Link to post
Share on other sites



FileSelectFolder?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

That works for opening up a new window to select a folder. but I have a guictrlcreatelistview that i need the directory to populate in. Thats what i am having a problem remembering is how to populate the computer files in the guictrlcreatelistview. same exact thing as fileselectfolder without popup.


It always amazes me how one little thing can cause so much havoc

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I see.

So this thread or this one might help (I searched the forum for "treeview directory listing")

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

thank you, thats what i am looking for. I do not remember it being that much code in the past, but it will work great

I just wanted to thank you again. worked great.

Edited by damon

It always amazes me how one little thing can cause so much havoc

Share this post


Link to post
Share on other sites

Ok, I am having one more problem that I cannot figure out. I now have included the explorer in to my script the way I need it. but I cannot figure out how to read the complete dir structure that is selected.

I have tried to use _guictrltreeview_getitemhandle, _guictrltreeview_getselected, _guictrltreeview_getselected, also tried just a simple guictrlread w/1 - but it only gave me the name of the selection and not the full path.

In this script you will see $SelectFileBrowse this is were i need the dir read to be sent to the fileopendialog.

Func SoftwareManagement()



            $SoftwareManagement =       GUICreate("Software Management", 863, 598, 167, 182, BitOR($WS_MAXIMIZEBOX,$WS_SIZEBOX,$WS_MAXIMIZE,$WS_THICKFRAME,$WS_SYSMENU,$WS_OVERLAPPEDWINDOW,$WS_TILEDWINDOW,$WS_MAXIMIZE,$WS_CHILD,$WS_TABSTOP,$WS_CLIPSIBLINGS), -1, $TnImageSuite);;964, 688
                                        GUISetIcon($icon, -1)

                        $Group1 =       GUICtrlCreateGroup("MSI Builder", 10, 424, 417, 57)
                        $Label1 =       GUICtrlCreateLabel("MSI Discovery Tool, for Creating MSI Packages", 24, 448, 287, 20, 0)
                                        GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
           $DiscoveryToolButton =       GUICtrlCreateButton("Discovery", 338, 440, 75, 25, $BS_NOTIFY)
                                        GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
                                        GUICtrlCreateGroup("", -99, -99, 1, 1)


      $ExitPackageBuilderButton =       GUICtrlCreateButton("Exit", 328, 552, 75, 25, $BS_NOTIFY)
                                        GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
                   $ApplyButton =       GUICtrlCreateButton("Apply", 216, 552, 75, 25, $BS_NOTIFY)
                                        GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
                     $Progress1 =       GUICtrlCreateProgress(8, 504, 414, 25, 0)


                        $Group2 =       GUICtrlCreateGroup("New Software Installation", 440, 8, 409, 569)
              $FindSwitchButton =       GUICtrlCreateButton("Find Switch", 743, 536, 91, 25, $BS_NOTIFY)
                                        GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
                     $SelectDir =       GUICtrlCreateTreeView(456, 112, 378, 230)
                    $SelectFile =       GUICtrlCreateInput("", 456, 376, 289, 24, $GUI_SS_DEFAULT_INPUT)
                                        GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
              $SelectFileBrowse =       GUICtrlCreateButton("Browse", 759, 376, 75, 25, $BS_NOTIFY)
                                        GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
              $SingleFileBrowse =       GUICtrlCreateButton("Browse", 759, 456, 75, 25, $BS_NOTIFY)
                                        GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
                    $SingleFile =       GUICtrlCreateInput("", 456, 456, 289, 24, $GUI_SS_DEFAULT_INPUT)
                                        GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
                  $SoftwareName =       GUICtrlCreateInput("", 456, 56, 377, 24, $GUI_SS_DEFAULT_INPUT)
                                        GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
                  $SelectSwitch =       GUICtrlCreateInput("", 456, 536, 241, 24, $GUI_SS_DEFAULT_INPUT)
                                        GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
                        $Label2 =       GUICtrlCreateLabel("Select Directory of installation File(s)", 456, 88, 219, 20, 0)
                                        GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
                        $Label3 =       GUICtrlCreateLabel("Select Single Installation File within Directory Above.", 456, 352, 312, 20, 0)
                                        GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
            $SingleFileCheckBox =       GUICtrlCreateCheckbox("Single File Installation (Contains No other Files)", 456, 424, 369, 17)
                                        GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
                        $Label4 =       GUICtrlCreateLabel("Software Name/Revision", 456, 32, 153, 20, 0)
                                        GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
                        $Label5 =       GUICtrlCreateLabel("Please Select Switch for Installer", 456, 488, 196, 20, 0)
                                        GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
                        $Label6 =       GUICtrlCreateLabel("Ex: /s /quiet /qn /q", 456, 512, 97, 17, 0)
                                        GUICtrlCreateGroup("", -99, -99, 1, 1)


                        $Group3 =       GUICtrlCreateGroup("Package Selection", 8, 8, 417, 401)
                         $List1 =       GUICtrlCreateList("", 16, 64, 305, 326, BitOR($LBS_NOTIFY,$LBS_SORT,$WS_BORDER))
                                        GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
    $RemovePackageBuilderButton =       GUICtrlCreateButton("Remove", 336, 208, 75, 25, $BS_NOTIFY)
                                        GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
       $AddPackageBuilderButton =       GUICtrlCreateButton("Add", 336, 136, 75, 25, $BS_NOTIFY)
                                        GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
       $NewPackageBuilderButton =       GUICtrlCreateButton("New", 336, 32, 75, 25, $BS_NOTIFY)
                                        GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
                   $PackageName =       GUICtrlCreateCombo("Select Package", 16, 32, 305, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
                                        GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
                                        GUICtrlCreateGroup("", -99, -99, 1, 1)
                                        GUISetState(@SW_SHOW)

    DisableSoftwareadd()


    If FileExists($config) Then
        $PackageNames = IniReadSectionNames ($config) ;;Reads Packages that are writen to the ini file
            $x = $PackageNames[0]

                Do
                    GUICtrlSetData ($PackageName, $PackageNames[$x])
                        $x = $x - 1
                until $x = 0
            Else
                $PackageNames = "Select Package"
                IniWrite ($config, $PackageNames,"123","")
                IniDelete ($config, $PackageNames, "123")
    EndIf


While 1
    $nMsg = GUIGetMsg(1)
    Select
        Case $nMsg[0] = $GUI_EVENT_CLOSE
            GUIDelete($SoftwareManagement)
                GUICtrlsetstate ($MenuItem1, $GUI_ENABLE)
                    GUICtrlSetState ($MenuItem2, $GUI_ENABLE)
                        Exitloop(1)

        Case $nMsg[0] = $DiscoveryToolButton

        Case $nMsg[0] = $ExitPackageBuilderButton
            GUIDelete($SoftwareManagement)
                GUICtrlsetstate ($MenuItem1, $GUI_ENABLE)
                    GUICtrlSetState ($MenuItem2, $GUI_ENABLE)
                        Exitloop(1)

        Case $nMsg[0] = $ApplyButton
            ;;DisableSoftwareadd()
            GUICtrlSetState ($SingleFileCheckBox, $GUI_UNCHECKED)
            GUICtrlSetState ($List1,$GUI_ENABLE)
            GUICtrlSetState ($SelectDir, $GUI_ENABLE)
            GUICtrlSetState ($SelectFileBrowse, $GUI_ENABLE)
            GUICtrlSetState ($SelectFile, $GUI_ENABLE)
            GUICtrlSetState ($SingleFile, $GUI_DISABLE)
            GUICtrlSetState ($SingleFileBrowse, $GUI_DISABLE)

        Case $nMsg[0] = $FindSwitchButton

        Case $nMsg[0] = $SelectFileBrowse
            $treeread = _TreePath($hWnd,$item)
            MsgBox (0,"",$txt)
            FileOpenDialog ("Select Installation File", $txt, "All (*.*)")

        Case $nMsg[0] = $SingleFileBrowse

        Case $nMsg[0] = $SingleFileCheckBox
            $SingleFileCheckBoxread = GUICtrlRead ($SingleFileCheckBox)
            If $SingleFileCheckBoxread = 1 Then
                GUICtrlSetState ($List1,$GUI_DISABLE)
                GUICtrlSetState ($SelectDir, $GUI_DISABLE)
                GUICtrlSetState ($SelectFileBrowse, $GUI_DISABLE)
                GUICtrlSetState ($SelectFile, $GUI_DISABLE)
                GUICtrlSetState ($SingleFile, $GUI_ENABLE)
                GUICtrlSetState ($SingleFileBrowse,$GUI_ENABLE)

            Else
                GUICtrlSetState ($List1,$GUI_ENABLE)
                GUICtrlSetState ($SelectDir, $GUI_ENABLE)
                GUICtrlSetState ($SelectFileBrowse, $GUI_ENABLE)
                GUICtrlSetState ($SelectFile, $GUI_ENABLE)
                GUICtrlSetState ($SingleFile, $GUI_DISABLE)
                GUICtrlSetState ($SingleFileBrowse, $GUI_DISABLE)


            EndIf


        Case $nMsg[0] = $RemovePackageBuilderButton

        Case $nMsg[0] = $AddPackageBuilderButton
                    $PackageName1 = GUICtrlRead($PackageName)
                    Select
                        Case $PackageName1 = ""
                            MsgBox (0, "ADD ERROR", "Please Create or Select a Package to ADD Software to.")

                        Case $PackageName1 = "Select Package"
                            MsgBox (0, "ADD ERROR", "Please Create or Select a Package to ADD Software to.")

                        Case Else
                            EnableSoftwareadd()
                            GUICtrlSetState ($List1,$GUI_ENABLE)
                            GUICtrlSetState ($SelectDir, $GUI_ENABLE)
                            GUICtrlSetState ($SelectFileBrowse, $GUI_ENABLE)
                            GUICtrlSetState ($SelectFile, $GUI_ENABLE)
                            GUICtrlSetState ($SingleFile, $GUI_DISABLE)
                            GUICtrlSetState ($SingleFileBrowse, $GUI_DISABLE)

                            ;;---------------------------;;Thanks to spudw2k at http://www.autoitscript.com/forum/index.php?showtopic=80327
                            $tImage = _GUIImageList_Create(16, 16, 5, 2)  ;Treeview Icon Image List
                                _GUIImageList_AddIcon($tImage, @SystemDir & "\shell32.dll", 3) ;Folder
                                _GUIImageList_AddIcon($tImage, @SystemDir & "\shell32.dll", 4) ;Folder Open
                                _GUIImageList_AddIcon($tImage, @SystemDir & "\shell32.dll", 181) ;Cdr
                                _GUIImageList_AddIcon($tImage, @SystemDir & "\shell32.dll", 8) ;Fixed
                                _GUIImageList_AddIcon($tImage, @SystemDir & "\shell32.dll", 7) ;Removable
                                _GUIImageList_AddIcon($tImage, @SystemDir & "\shell32.dll", 9) ;Network
                                _GUIImageList_AddIcon($tImage, @SystemDir & "\shell32.dll", 11) ;CDRom
                                _GUIImageList_AddIcon($tImage, @SystemDir & "\shell32.dll", 109) ;No Symbol for Burner

                            _GUICtrlTreeView_SetNormalImageList($SelectDir, $tImage)

                            $drives = DriveGetDrive("FIXED")
                            If @error  Then Exit
                            For $x = 1 To $drives[0]
                                $icon=0
                                If DriveGetType($drives[$x]) = "Fixed" Then $icon=3
                                If DriveGetType($drives[$x]) = "Removable" Then $icon=4
                                If DriveGetType($drives[$x]) = "Network" Then $icon=5
                                If DriveGetType($drives[$x]) = "CDROM" Then $icon=6
                                If $icon=0 Then
                                    $new = _GUICtrlTreeView_AddChild($SelectDir,"",$drives[$x],0,1)
                                Else
                                    $new = _GUICtrlTreeView_AddChild($SelectDir,"",$drives[$x],$icon,$icon)
                                EndIf
                            Next

                            GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")  ;Last steps before GUI Display

                            GUISetState()


                            ;;--------------------------------------------------------------


                    EndSelect

        Case $nMsg[0] =     $NewPackagebuilderButton
            NewPackageName()

        Case $nMsg[0] = $PackageName
            GUICtrlSetData ($List1,"")
                $PackageName1 = GUICtrlRead($PackageName)

                    $PackageName2 =     IniReadSection ($config, $PackageName1)
                        If @error Then;;$PackageName1 <> "Select Package" Then

                        Else
                            $w =    $PackageName2[0][0]

                            Do
                                GUICtrlSetData ($List1, $PackageName2[$w][0])
                                    $w = $w -1
                            Until $w = 0
                        EndIf

        Case $HelpContent


    EndSelect
WEnd
EndFunc

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) ;Notify func
    Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR
    $srctree = ControlGetHandle($hwnd,"",$SelectDir)
    ;$srclist = ControlGetHandle($hwnd,"",$listview)
    $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
    $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
    $iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
    $iCode = DllStructGetData($tNMHDR, "Code")
    If $iCode = -12 Or $iCode = -17 Then Return False
    Switch $hWndFrom
        #cs
        Case $srclist

            Switch $iCode
                Case $NM_DBLCLK
                    If $item[0]<>0 Then
                        $filefolder = _GUICtrlListView_GetSelectedIndices($listview,True)
                        If _GUICtrlListView_GetItemText($listview,$filefolder[1],1) = "Folder" Then
                            $idx = _GUICtrlTreeView_GetSelection($SelectDir)
                            $item = StringTrimLeft($item[1],stringInstr($item[1],"\",0,-1))
                            $found = _GUICtrlTreeView_FindItem($SelectDir,$item,False,$idx)
                            _GUICtrlTreeView_SelectItem($SelectDir,$found)
                            _FillFolder($SelectDir)
                            _ShowFolder($SelectDir,$listview,$gui)
                        Else
                            Run(@Comspec & " /c " & chr(34) & $item[1] & chr(34),"",@SW_HIDE)
                            sleep(1500)
                        EndIf
                    EndIf
                    Return TRUE
            EndSwitch
            #ce

        Case $srctree
            Switch $iCode
                Case $NM_RCLICK
                    Local $tPOINT = _WinAPI_GetMousePos(True, $srctree)
                    Local $iX = DllStructGetData($tPOINT, "X")
                    Local $iY = DllStructGetData($tPOINT, "Y")

                    Local $hItem = _GUICtrlTreeView_HitTestItem($srctree, $iX, $iY)
                    If $hItem <> 0 Then _GUICtrlTreeView_SelectItem($srctree, $hItem, $TVGN_CARET)

                Case -451
                    _FillFolder($SelectDir)
                    ;_ShowFolder($SelectDir,$listview,$gui)
                    Return TRUE

            EndSwitch

        Case Else
            Switch $iCode
                Case $NM_CLICK  ; The user has clicked the left mouse button within the control

                        _SendMessage($SoftwareManagement, $WM_SYSCOMMAND, 0xF012, 2,1)

            EndSwitch
    EndSwitch
EndFunc;==> WM_NOTIFY

Func _FillFolder(ByRef $hWnd) ;Fill Folder in TreeView
    $item = _GUICtrlTreeView_GetSelection($hWnd)
    If _GUICtrlTreeView_GetChildCount($hWnd,$item) <= 0 Then
        _GUICtrlTreeView_BeginUpdate($SelectDir)
        $txt = _TreePath($hWnd,$item)
        _SearchFolder($txt,$item)
        _GUICtrlTreeView_EndUpdate($SelectDir)
    EndIf
EndFunc;==> _FillFolder()

Func _FolderFunc($folders,$folder,$parent,$level) ;Add Folder to Source TreeView
    If $parent = 0x00000000 Then Return
    For $i = 1 To UBound($folders)-1
        $parentitem = _GUICtrlTreeView_AddChild($SelectDir,$parent,$folders[$i],0,1)
        _SearchFolder($folder & "\" & $folders[$i],$parentitem,$level+1)
    Next
EndFunc;==> _FolderFunc()

Func _SearchFolder($folder,$parent,$level=0) ;Recursive Folder Search for Source Treeview/Listview
    If $level >= 1 Then Return
    $folders = _FileListToArray($folder,"*",2)
    _FolderFunc($folders,$folder,$parent,$level)
EndFunc;==> _SearchFolder()

Func _TreePath($hWnd,$item)  ;Determine full path of selected item in TreeView
    $txt = _GUICtrlTreeView_GetText($hWnd,$item)
    Do
        $parent = _GUICtrlTreeView_GetParentHandle($hWnd,$item)
        If $parent <> 0 Then
            $txt = _GUICtrlTreeView_GetText($hWnd,$parent) & "\" & $txt
            $item = $parent
        EndIf
    Until $parent = 0
    Return $txt
EndFunc;==> _TreePath()

thanks,

Damon


It always amazes me how one little thing can cause so much havoc

Share this post


Link to post
Share on other sites

I think with _GuiCtrlTreeView_GetSelected you get the handle to selected items. Use this handle with function _GUICtrlTreeView_GetText to get the displayed text.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

I think with _GuiCtrlTreeView_GetSelected you get the handle to selected items. Use this handle with function _GUICtrlTreeView_GetText to get the displayed text.

ok, I tried this next, but was returned with a blank msgbox.

I only get True/False with _guictrltreeview_getselected

I get nothing or blank with _guictrltreeview_gettext

I get the expected handle with _guictrltreeview_getitemhandle

$treeread1 = _GUICtrlTreeView_GetItemHandle($SelectDir)
            $treeread = _GUICtrlTreeView_GetSelected ( $treeread1, $SelectDir)
            $txt1 = _GUICtrlTreeView_GetText ($treeread)

            MsgBox (0,"",$txt1)
            MsgBox (0,"",$treeread)
            MsgBox (0,"",$treeread1)
            ;FileOpenDialog ("Select Installation File", $treeread, "All (*.*)")

It always amazes me how one little thing can cause so much havoc

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Use _GUICtrlTreeView_GetSelection to get the currently selected item (handle).

$hTreeView = GUICtrlCreateTreeView(...)
$hSelectedItem = _GUICtrlTreeView_GetSelection($hTreeView)
$sText = _GUICtrlTreeView_GetText($hTreeView, $hSelectedItem)
should do the trick. Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Use _GUICtrlTreeView_GetSelection to get the currently selected item (handle).

$hTreeView = GUICtrlCreateTreeView(...)
$hSelectedItem = _GUICtrlTreeView_GetSelection($hTreeView)
$sText = _GUICtrlTreeView_GetText($hTreeView, $hSelectedItem)
should do the trick.

I tried this and got the handle but $txt1 was still blank. like it is not seeing anything, but everything works great except reading dir structure.

$treeread1 = _GUICtrlTreeView_GetSelection($SelectDir)
            $txt1 = _GUICtrlTreeView_GetText ($treeread1)

            MsgBox (0,"",$txt1)
            MsgBox (0,"",$treeread1)

sorry, did not see the script you attached, trying now. thanks,

Edited by damon

It always amazes me how one little thing can cause so much havoc

Share this post


Link to post
Share on other sites

I tried this and got the handle but $txt1 was still blank. like it is not seeing anything, but everything works great except reading dir structure.

$treeread1 = _GUICtrlTreeView_GetSelection($SelectDir)
            $txt1 = _GUICtrlTreeView_GetText ($treeread1)

            MsgBox (0,"",$txt1)
            MsgBox (0,"",$treeread1)

sorry, did not see the script you attached, trying now. thanks,

Please re-check the parameters you specify:

_GUICtrlTreeView_GetSelection needs the handle to the TreeView

_GUICtrlTreeView_GetText needs the handle to the treeView (parameter 1) plus the handle or id of the selected item (parameter 2 as returned by GetSelection)

So your _GUICtrlTreeView_GetText call is wrong.

BTW: When you debug a script it is always a good idea to check the return value and @error after a function call.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Please re-check the parameters you specify:

_GUICtrlTreeView_GetSelection needs the handle to the TreeView

_GUICtrlTreeView_GetText needs the handle to the treeView (parameter 1) plus the handle or id of the selected item (parameter 2 as returned by GetSelection)

So your _GUICtrlTreeView_GetText call is wrong.

BTW: When you debug a script it is always a good idea to check the return value and @error after a function call.

Well I am now getting the selected but not the full dir structure. any ideas? it will show me say "windows" being it is selected, but not "c:\windows"

$treeread1 = _GUICtrlTreeView_GetSelection($SelectDir)
            $txt1 = _GUICtrlTreeView_GetText ($SelectDir, $treeread1)

            MsgBox (0,"",$txt1)
            MsgBox (0,"",$treeread1)
            ;FileOpenDialog ("Select Installation File", $treeread, "All (*.*)")

It always amazes me how one little thing can cause so much havoc

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

Holly Crap.... I just found it, well something that will get me what I want.

_guictrltreeview_gettree

it outputs c:|windows but i can stringsplit and add "\".

thanks for your help "water"

much appreciated.

Damon

here is the code i came up with. this may help someone later.

$treeread1 = _GUICtrlTreeView_GetSelection($SelectDir)
            $txt3 = _GUICtrlTreeView_GetTree ($SelectDir, $treeread1)
            $txt4 = StringSplit ($txt3, "|",0)

            $x = 1
            $txt5 = $txt4[1]

            Do
                $x = $x + 1
                $txt5 = $txt5 & "\" & $txt4[$x]

            Until $x = $txt4[0]
Edited by damon

It always amazes me how one little thing can cause so much havoc

Share this post


Link to post
Share on other sites

Or just do a

$txt4 = StringReplace($txt3,"|","\")


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

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