Sign in to follow this  
Followers 0
YoniB

Help Please - Should Be Simple, But...

6 posts in this topic

Hi there!

I just need to write a new text line in existing file (can be *.txt) in a specific line, without "touching" other lines content... I tried everything I know, but nothing... Where I go wrong???

Thanks in advance!

Share this post


Link to post
Share on other sites



Hi there!

I just need to write a new text line in existing file (can be *.txt) in a specific line, without "touching" other lines content... I tried everything I know, but nothing... Where I go wrong???

Thanks in advance!

Lookup _FileWriteToLine in the helpfile - Needs Beta


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

FileWriteLine() is exactly what is needed...

$file = FileOpen("test.txt", 1)
;Mode (read or write) to open the file in.
;Can be a combination of the following:
;  0 = Read mode
;  1 = Write mode (append to end of file)
;  2 = Write mode (erase previous contents)
;  4 = Read raw mode
;  8 = Create directory structure if it doesn't exist (See Remarks).
;Both write modes will create the file if it does not already exist but a non;existent folder (except using mode '8' - See Remarks).

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

FileWriteLine($file, "Line1")

FileClose($file)

If you notice... FileOpen with a parameter of 1 allows the appendage of a file.

Hope this helps,

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

FileWriteLine() is exactly what is needed...

FileWriteLine can only append to the file wheras _FilWriteToLine will write to any specified line no.


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

FileWriteLine can only append to the file wheras _FilWriteToLine will write to any specified line no.

His post asks for an append to the end of the file to my understanding.

Oh no... I just read where he said after he wants "I just need to write a new text line in existing file" that he wants "in a specific line".

My apologies :)

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

Thank you all - It was very helpful!!!

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