supadodger Posted March 26, 2009 Share Posted March 26, 2009 (edited) i dont actually need to delete the line but im not good enough at creating arrays or anything to have it just go down the file and read 1 line at a time the file is like this james brown john brown and i need to FileReadLine ("names.txt",1) and have it cycle through the list. the only way i have been able to get it is to fileread remove first line file delete then filewrite. but then everytime its out i have to go copy my text file back and start it over. Edited March 26, 2009 by supadodger Link to comment Share on other sites More sharing options...
BinaryBrother Posted March 26, 2009 Share Posted March 26, 2009 (edited) #Include <File.au3> _FileReadtoArray(@SciptDir & "\file.txt",$Array) For $N = 1 To $Array[0] MsgBox(0,"Test",$Array[$N]) NextThis will display a message box, and show the contents of each line of your file... Line by Line.Array's are really awesome once you learn to use them, focus on that a bit more, and it will broaden your ability to program better. Optionally to skip the first line, change "For $N = 1 To"... To "For $N = 2 To..." Edited March 26, 2009 by BinaryBrother SIGNATURE_0X800007D NOT FOUND Link to comment Share on other sites More sharing options...
supadodger Posted March 26, 2009 Author Share Posted March 26, 2009 i figured id rather randomize and figured it out myself heres wjhat i came up with. $maclist = FileRead ("macs.txt") $macalmost = StringSplit($maclist, @CRLF) While 1 $z1 = Random(1, 200,1) $macread = $macalmost[$z1] ClipPut ($macread) msgbox (0,"",$macread) wend Link to comment Share on other sites More sharing options...
GEOSoft Posted March 26, 2009 Share Posted March 26, 2009 StringSplit($maclist, @CRLF) will work in most situations but not all. Some files don't use @CR (html for example) so you are better off to either use _FileReadToArray() [prefered] or $macList = StringStripCR(FileRead("macs.txt")) $macalmost = StringSplit($maclist, @LF) George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" 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