WifiHero Posted June 8, 2008 Posted June 8, 2008 Is there some way to? I have tried just about everything >< $file = FileDelete("Txt.txt" 1) And ect. Any ideas?
WifiHero Posted June 8, 2008 Author Posted June 8, 2008 (edited) _FileWriteToLine()Be abit more specific? Tried it and it didnt work.EDIT:Tried $_FileWriteToLine("txt.txt",1) $_FileWriteToLine("txt.txt"), $_FileWriteToLine()And more, But didnt get any results. Edited June 8, 2008 by WifiHero
Paulie Posted June 8, 2008 Posted June 8, 2008 (edited) Open the Help File. _FileWriteToLine -------------------------------------------------------------------------------- Writes text to a specific line in a file. #Include <File.au3> _FileWriteToLine($sFile, $iLine, $sText[, $fOverWrite = 0]) Parameters $sFile - The file to write to $iLine - The line number to write to $sText - The text to write $fOverWrite - If set to 1 will overwrite the old line, If set to 0 will not overwrite Remarks If _FileWriteToLine is called with $fOverWrite as 1 and $sText as "", it will delete the line.Example: #Include <File.au3> _FileWriteToLine("txt.txt", 2, "",1) ;will delete the second line of file Edited June 8, 2008 by Paulie
WifiHero Posted June 8, 2008 Author Posted June 8, 2008 Open the Help File. Example: #Include <File.au3> _FileWriteToLine("txt.txt", 2, "",1) ;will delete the second line of fileNo disrespect man...But it didnt work.
Cater Posted June 8, 2008 Posted June 8, 2008 It works but if you have file like that: 1 2 3 4 5 if you use this: _FileWriteToLine("txt.txt", 2, "",1) file will looks like that 1 2 4 5 but if you want empty space in 3 line you can use this: _FileWriteToLine("txt.txt", 2, " ",1) and file will looks like that: 1 2 4 5 but there will be 1 space.
WifiHero Posted June 8, 2008 Author Posted June 8, 2008 (edited) It works but if you have file like that:12345if you use this: _FileWriteToLine("txt.txt", 2, "",1)file will looks like that1245but if you want empty space in 3 line you can use this: _FileWriteToLine("txt.txt", 2, " ",1)and file will looks like that:12 45but there will be 1 space.Thats preciclly how I want it to be, But the problem is, All I get when I put in the code is -error, unreconized command-And it does nothing.EDIT:As in I want it to remove it without a space remaining. Edited June 8, 2008 by WifiHero
tannerli Posted June 8, 2008 Posted June 8, 2008 maybe you like this one:http://www.autoitscript.com/forum/index.php?showtopic=55496with that you can also search for specific lines to delete
herewasplato Posted June 9, 2008 Posted June 9, 2008 ...if you use this: _FileWriteToLine("txt.txt", 2, "",1)file will looks like that1245...I would hope that it would lokk like:1345:-) [size="1"][font="Arial"].[u].[/u][/font][/size]
nobbe Posted June 9, 2008 Posted June 9, 2008 i did it like this expandcollapse popup#include <String.au3> Local $f_in = @ScriptDir & "\error.log"; Local $f_out = @ScriptDir & "\error.new"; Local $oldline = ""; $fh_in = FileOpen($f_in, 0) $fh_out = FileOpen($f_out, 2) ; write ; Check if file opened for reading OK If $fh_in = -1 Then MsgBox(0, "Error", "Unable to open file.") exit; EndIf While 1 $line = FileReadLine($fh_in) If @error = -1 Then ExitLoop If StringInStr($line, "TEST") > 0 Then ; dont write out TEST ConsoleWrite($line & @CRLF); else FileWriteLine($fh_out, $line); all other lines EndIf WEnd FileClose($fh_in) FileClose($fh_out) FileMove ($f_in , @ScriptDir & "\error.lo1"); FileMove ($f_out, @ScriptDir & "\error.log");
herewasplato Posted June 9, 2008 Posted June 9, 2008 ...All I get when I put in the code is -error, unreconized command-...Did you use #Include <File.au3> ...and what version of AutoIt are you using?#include <File.au3> _FileWriteToLine("temp.txt", 2, "", 1)works fine with v3.2.12.0 [size="1"][font="Arial"].[u].[/u][/font][/size]
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