Jump to content

Prevent the function from taking values


Go to solution Solved by Zedna,

Recommended Posts

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
Link to comment
Share on other sites

  • Solution

; 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
Link to comment
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

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