Jump to content
Sign in to follow this  

Add Count

Recommended Posts


I was unable to post this in examples, or anything in examples for that matter. why is that? >_<

I would like to share some little things i have created because i have learned so much from these forums.

if you have a text file with strings in a list you can add a count to the beginning of them using this

Hopefully this will help anyone somewhere along the way even if you hack it up and use it another way.

$file = FileOpen("test.txt", 0)
$inc = 0
If $file = -1 Then
    MsgBox(0, "Error", "Unable to open file.")

; Read in lines of text and add 1. 2. 3. 4. etc...
While 1
    $line = FileReadLine($file)
    If @error = -1 Then ExitLoop
    $inc = $inc+1
    $line = $inc & "." & $line
    filewrite("test1.txt",$line & @CRLF)


I have been looking around here for a while now and would like to be active, so here i am.


Share this post

Link to post
Share on other sites

thanks, appreciated.


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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.