Jump to content

Recommended Posts

Posted

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?

Posted (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 by Siao

"be smart, drink your wine"

Posted (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 by gamepin126
  • 3 weeks later...
Posted

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
Posted

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

What 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.
  :)

  • Developers
Posted (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 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.
  :)

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...