leuce Posted August 8, 2006 Share Posted August 8, 2006 (edited) G'day everyone I have a file named enname.txt in the same directory as the script, and that file contains five lines of text containing one or two words per line. The line breaks are @CRLFs. I'm trying to populate an array with those lines, but I keep getting the "no delimiters found" error. $enname1 = FileOpen (@ScriptDir & "\enname.txt", 0) $enname2 = StringSplit ($enname1, @CRLF, 1) MsgBox (0, "", $enname2[0], 10) Exit And the message box says "1", which means "no delimiters found". I've tried @CRLF in quotes, and I've tried setting the delimiter size to 1 instead of 0, but no luck. I've also tried other delimiters (and I tried putting everything in enname.txt on a single line too). Any ideas? Thanks Samuel Edited August 8, 2006 by leuce Link to comment Share on other sites More sharing options...
/dev/null Posted August 8, 2006 Share Posted August 8, 2006 I'm trying to populate an array with those lines, but I keep getting the "no delimiters found" error.Then, use _FileReadToArray()CheersKurt __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf * Link to comment Share on other sites More sharing options...
leuce Posted August 8, 2006 Author Share Posted August 8, 2006 Then, use _FileReadToArray() Thanks... so... what does "ByRef" mean (in the helpfile in the _FileReadToArray() entry)? I can't get the array to populate with: #include <file.au3> Dim $enname2 _FileReadToArray(@ScriptDir & "\enname.txt", $enname2) MsgBox (0, "", $enname2[0], 10) Exit Thanks Samuel Link to comment Share on other sites More sharing options...
rambo3889 Posted August 8, 2006 Share Posted August 8, 2006 Use beta My Scripts:Radioblog Club Music DownloaderOther stuff:Fun movieIm serious read the help file it helps :PFight 'Till you drop. Never stop, You Cant give up. Til you reach the top Fight! youÂ’re the best in town Fight! Link to comment Share on other sites More sharing options...
xcal Posted August 8, 2006 Share Posted August 8, 2006 Try this (change "yourfile.txt") Dim $file = "yourfile.txt" $fileread = FileRead($file) $filesplit = StringSplit($fileread, @CRLF) MsgBox(0, "", "your array has " & $filesplit[0] & " entries") For $i = 1 To $filesplit[0] Step 2 ;skip the @crlf entries MsgBox(0, "", "$filesplit[" & $i & "] is " & '"' & $filesplit[$i] & '"') Next How To Ask Questions The Smart Way Link to comment Share on other sites More sharing options...
leuce Posted August 8, 2006 Author Share Posted August 8, 2006 Try this (change "yourfile.txt") Thanks... there were some bugs in your script, but I could figure them out easily, and it helps. Dim $file = @ScriptDir & "\enname.txt" $fileread = FileRead($file, FileGetSize($file)) $filesplit = StringSplit($fileread, @CRLF, 1) MsgBox(0, "", "your array has " & $filesplit[0] & " entries") For $i = 1 To $filesplit[0] MsgBox(0, "", "$filesplit[" & $i & "] is " & '"' & $filesplit[$i] & '"') Next However, since I'm only going to use this script once ever, and since I know how many lines the file has, I might also use FileReadLine with each loop (later the script) instead of populating an array. Thanks everyone! Link to comment Share on other sites More sharing options...
dandymcgee Posted August 8, 2006 Share Posted August 8, 2006 hello - Dan [Website] Link to comment Share on other sites More sharing options...
xcal Posted August 8, 2006 Share Posted August 8, 2006 (edited) There weren't any bugs on my script for my test... maybe for your use. FileGetSize($file) doesn't make sense. Default is read the whole file, and FileGetSize returns the file size. @ScriptDir & "\enname.txt" isn't necessary, since the script will check the same folder by default. The loop was just to show you where your lines were in the array. Edited August 8, 2006 by xcal How To Ask Questions The Smart Way 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