Sign in to follow this  
Followers 0
Dracil

Adding text to a textfile

4 posts in this topic

Like the title say, i want to add text to a textfile(txt), the textfile will already contain text so its important not to overwrite it, just add.

Anyone have any idea how to do this ?

Thanks in advance!

Share this post


Link to post
Share on other sites




- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

I'm new to scripting with AutoIt but I looked a bit in the help file and found this.

Directly from Help File, all credit to AutoIT team.

$file = FileOpen("test.txt", 1)

; Check if file opened for writing OK
If $file = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf

FileWriteLine($file, "Line1")
FileWriteLine($file, "Line2" & @CRLF)
FileWriteLine($file, "Line3")

FileClose($file)

Share this post


Link to post
Share on other sites

Use FileOpen in append mode. Look up the help file.

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