Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Checking folder for files if empty then crash

$
0
0

Hi,

 

i have problem, i started using an array for checking files in a folder and adding them to a combobox.

But if the folder is empty then my script crashes, i tried to check the array with:

                    $NAME   = GUICtrlRead($AFDELINGLIST)                     $VAR    = IniRead("P:\Afdelingen\afdelingen.ini", "names", $NAME, "")                 GUICtrlSetState($SOFTWARE, $GUI_ENABLE)                 GUICtrlSetData($SOFTWARE, "")                 GUICtrlSetData($SOFTWARE, "Geen installatie bestanden")                 GUICtrlSetData($SOFTWARE, "================================================")                     Local $FileList = _FileListToArray("P:\Software\Afdelingen\" & $VAR & "\", "*.*", $FLTA_FILES)                         For $i = 1 To $FileList[0]                             If $i <> "" Then                                 GUICtrlSetData($SOFTWARE, $FileList[$i])                             EndIf                         Next

But when i run my script and i get to the point where it reads the ini file (checked the values comming from that with msgbox, they are good), after that it should go to the array but then it crashes if the folder is empty, if i add a file the array works. 

 

How can i catch this error?


Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>