Sign in to follow this  
Followers 0
FrankwazHere

Add Count

3 posts in this topic

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.")
    Exit
EndIf

; 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)
Wend

FileClose($file)

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


;Frank. 

Share this post


Link to post
Share on other sites



thanks, appreciated.


;Frank. 

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  
Followers 0