MasterX Posted October 17, 2008 Share Posted October 17, 2008 (edited) 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 October 17, 2008 by MasterX Link to comment Share on other sites More sharing options...
torels Posted October 17, 2008 Share Posted October 17, 2008 $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 More sharing options...
MasterX Posted October 17, 2008 Author Share Posted October 17, 2008 I think you misunderstood me I don´t want to write some text at the end. I want to change a line which is already there without deleting the whole text. Link to comment Share on other sites More sharing options...
torels Posted October 17, 2008 Share Posted October 17, 2008 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 More sharing options...
onestcoder Posted October 17, 2008 Share Posted October 17, 2008 (edited) 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 October 17, 2008 by onestcoder Need a website: http://www.iconixmarketing.com Link to comment Share on other sites More sharing options...
MasterX Posted October 17, 2008 Author Share Posted October 17, 2008 Thanks champ Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now