Jump to content

FileWrite


MasterX
 Share

Recommended Posts

Is it possible to do filewrite without deleting all the text and only be able to write at the end of the file ?

I want to write in line 2, but in line 1-11 is text, so i´m only be able to delete all the text when opening the file or write at the end of the file.

But i want only line 2 to be changed.

Edited by MasterX
Link to comment
Share on other sites

$filehandle = Fileopen(yourfile, 1)
Filewrite($filehandle, "some text at the end")
Fileclose($filehandle)

Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org

Link to comment
Share on other sites

hmm

I believe the only possible thing that can be done is FileReadLine then replace it in the whole text and rewrite all the file

Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org

Link to comment
Share on other sites

http://www.autoitscript.com/forum/index.ph...c=81010&hl=

_FileAppendToLine("filename", linenumber, "text you want added")

example:

_FileAppendToLine("test.txt", 2, "text you want added")


Func _FileAppendToLine($sFile, $sLine, $sString)
    Local $iRead, $aString, $iResult, $hFile, $i

    $iRead = FileRead($sFile)

    $aString = StringSplit(StringStripCR($iRead), @LF)
    If $aString[0] < $sLine Then Return SetError(1, 0, 0)

    $aString[$sLine] &= $sString

    For $i = 1 To $aString[0]
        $iResult &= $aString[$i] & @CRLF
    Next

    $hFile = FileOpen($sFile, 2)
    FileWrite($hFile, $iResult)
    FileClose($hFile)
EndFunc   ;==>_FileAppendToLine
Edited by onestcoder

Need a website: http://www.iconixmarketing.com

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...