Timo Posted April 10, 2005 Share 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 Link to comment Share on other sites More sharing options...
PerryRaptor Posted April 10, 2005 Share 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) Link to comment Share on other sites More sharing options...
Timo Posted April 10, 2005 Author Share 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 Link to comment Share on other sites More sharing options...
PerryRaptor Posted April 10, 2005 Share 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 Link to comment Share on other sites More sharing options...
Timo Posted April 10, 2005 Author Share Posted April 10, 2005 Thanks, I will check this. Bye...,Timo Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now