Timo 0 Posted April 10, 2005 Hello,I want to read the data from a csv-file and show it in a list.That's my code:$myedit = GUICtrlCreateList ("", 500,50,400,500)$adressfile = FileOpen("adress.dat",1)While 1 $line = FileReadLine ($adressfile) If @error = -1 Then exitloop GUICtrlSetData($myedit,$line) WendFileClose($adressfile)I have a lot of trouble with this, e.g. I cant use 1 in FileOpen, only 0 is o.k.Could someone please give me a short example how to do it the right way?Thanks,Timo Bye...,Timo Share this post Link to post Share on other sites
PerryRaptor 1 Posted April 10, 2005 Try this... $resource = FileOpen("resource.emp", 0) If $resource = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf While 1 $line = FileReadLine($resource) If @error = -1 Then ExitLoop If FileExists($line) Then ContinueLoop EndIf Wend FileClose($Resource) Share this post Link to post Share on other sites
Timo 0 Posted April 10, 2005 No, that doesn't solve the problem. This is the code with the GUI-part: $mylist = GUICtrlCreateList ("", 500,50,400,500) $resource = FileOpen("adress.dat", 0) If $resource = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf While 1 $line = FileReadLine($resource) If @error = -1 Then ExitLoop If FileExists($line) Then ContinueLoop GUICtrlSetData($mylist,$line) EndIf Wend FileClose($resource) The file which I want to open is a csv-file with the ";" as separator. Could this be the problem? Bye...,Timo Share this post Link to post Share on other sites
PerryRaptor 1 Posted April 10, 2005 Checkout this article... Filling Arrays from files Excel.csv 2 AutoIT Arrays Your csv file needs to be converted to an AutoIT Array Share this post Link to post Share on other sites
Timo 0 Posted April 10, 2005 Thanks, I will check this. Bye...,Timo Share this post Link to post Share on other sites