Jump to content
Sign in to follow this  
Hyflex

Complicated script help...

Recommended Posts

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?

Share this post


Link to post
Share on other sites

$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 by gamepin126

Share this post


Link to post
Share on other sites

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"

Share this post


Link to post
Share on other sites

$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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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 ?

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×
×
  • Create New...