Hyflex Posted September 13, 2007 Posted September 13, 2007 I need the script to add make some text inside a txt file so i have the file: Word.txt I want it to make the following but upto 10,000 DDS|1 DDS|2 DDS|3 DDS|4 DDS|5 DDS|6 DDS|7 DDS|8 DDS|9 and so on... Any ideas?
Siao Posted September 13, 2007 Posted September 13, 2007 (edited) Nothing complicated. $str = "" For $i = 1 to 10000 $str &= "DDS|" & $i & @CRLF Next FileWrite("Word.txt", $str) Edited September 13, 2007 by Siao "be smart, drink your wine"
gamepin126 Posted September 13, 2007 Posted September 13, 2007 (edited) $str = "" For $i = 1 to 10000 $str &= "DDS|" & $i FileWrite("Word.txt", $str) Next fixed it The @CRLF isn't necessary cuz it'll make a new line for every invokation of filewriteline. Edited September 13, 2007 by gamepin126
therks Posted September 13, 2007 Posted September 13, 2007 fixed it The @CRLF isn't necessary cuz it'll make a new line for every invokation of filewriteline. $str = "" For $i = 1 to 10000 $str &= "DDS|" & $i FileWriteLine("Word.txt", $str) Next I fixed it better. You forgot the "Line" in FileWriteLine. My AutoIt Stuff | My Github
Siao Posted September 13, 2007 Posted September 13, 2007 (edited) Anyone care to explain why it needed fixing in first place? HDD IO is slower than memory. Why open, write to file and close it 10000 times, when you can write 1? Not to mention your fixes are buggy, because $str holds all previous lines too. So excuse me while I rotfl Edited September 13, 2007 by Siao "be smart, drink your wine"
therks Posted September 13, 2007 Posted September 13, 2007 Haha, yes you are right, of course. I wasn't even looking at that, I just saw he didn't use FileWriteLine when he specifically said he did. My AutoIt Stuff | My Github
gamepin126 Posted September 14, 2007 Posted September 14, 2007 (edited) $str = "" For $i = 1 to 10000 $str &= "DDS|" & $i FileWriteLine("Word.txt", $str) NextoÝ÷ ØâÅçbµ·µêØ¢çè® -¶ªºKwªºbX¥yjâµæËw¿lÿêº^¨Z¶««,xV¬µø±n[¬«¢+ØÀÌØíÍÑÈôÅÕ½ÐìÅÕ½Ðì)½ÈÀÌØí¤ôÄѼÄÀÀÀÀ(ÀÌØíÍÑÈôÅÕ½ÐíMðÅÕ½ÐìµÀìÀÌØí¤(¥±]É¥Ñ1¥¹ ÅÕ½Ðí]½É¹ÑáÐÅÕ½Ðì°ÀÌØíÍÑȤ(%Q½½±Ñ¥À ÀÌØí¤°ÄÀ°ÄÀ¤)9áÐ I added the tooltip just cuz I like to see stuff working. Just remove it if you want. The reason it was holding all the previous values was because it had str &= instead of just =. I didn't even know you could do that. It works fine for me. Edited September 14, 2007 by gamepin126
therks Posted September 14, 2007 Posted September 14, 2007 Of course Siao's is still better, because as he said, it's faster to write all the data to the variable, and do ONE filewrite, than to do multiple filewrites. My AutoIt Stuff | My Github
Hyflex Posted September 29, 2007 Author Posted September 29, 2007 Nothing complicated. $str = "" For $i = 1 to 10000 $str &= "DDS|" & $i & @CRLF Next FileWrite("Word.txt", $str) that worked good for me, now i need another one with what i have just made i need to on the end of each line in word.txt to add the text: PnD
Developers Jos Posted September 29, 2007 Developers Posted September 29, 2007 that worked good for me, now i need another one with what i have just made i need to on the end of each line in word.txt to add the text: PnDWhat have you tried yourself ? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Hyflex Posted September 29, 2007 Author Posted September 29, 2007 What have you tried yourself ?I was looking though the ini writes.. but thats only ini....
Developers Jos Posted September 29, 2007 Developers Posted September 29, 2007 (edited) I was looking though the ini writes.. but thats only ini.... INI functions ?Thought you wanted to add something at the end of the record written to word.txt ? Edited September 29, 2007 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
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