Sign in to follow this  
Followers 0
soonyee91

Prevent the function from taking values

4 posts in this topic

I have a problem using this two functions "FileSelectFolder" and "_FileListToArray".

Whenever I click cancel button on the "FileSelectFolder". It will store value to my variable.

Is there anyway to stop the variable from taking values?

; Loop until user exits
    While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
         Case $msg = $btn_browse
        $ordner = FileSelectFolder("Choose folder","")
        $dateien = _FileListToArray($ordner, "*", 1)
   
   _GUICtrlListBox_BeginUpdate($hListBox)
         For $i = 1 To UBound($dateien) - 1
            ; Add file
    _GUICtrlListBox_AddString($hListBox, $dateien[$i])
 Next
  _GUICtrlListBox_EndUpdate($hListBox)
 
  Case $msg = $btn_transfer
                    ScanFolder($ordner)
                 EndSelect
               
WEnd

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

; Loop until user exits
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg = $btn_browse
            $tmp = FileSelectFolder("Choose folder", "")
            If Not @error Then
                $ordner = $tmp
                $dateien = _FileListToArray($ordner, "*", 1)

                _GUICtrlListBox_BeginUpdate($hListBox)
                For $i = 1 To UBound($dateien) - 1
                    ; Add file
                    _GUICtrlListBox_AddString($hListBox, $dateien[$i])
                Next
                _GUICtrlListBox_EndUpdate($hListBox)
            EndIf

        Case $msg = $btn_transfer
            ScanFolder($ordner)
    EndSelect
WEnd

Edited by Zedna

Share this post


Link to post
Share on other sites

Thanks! I think this is what I'm looking for.

My code structure is:

-Obtain files from "filefolderselect"

-Then update the listbox with "_GUICtrlListBox_AddString"

The problem is everytime I click on that browse button the listbox is not refresh(Continue to add string into the listbox)?

how should I structure my code then

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