yehia Posted April 7, 2009 Share Posted April 7, 2009 this is an easy function for line removing since i didnt find any when i was looking for one i know this may be simple but it can save time for some ppl out there and one more topic wouldnt hurt anyone Func _FileRemoveLine($sFile, $iLine) $aFile = FileOpen($sFile,0) Local $filtxt = FileRead(aFile, FileGetSize($sFile)) $filtxt = StringSplit($filtxt, @CRLF, 1) If UBound($filtxt, 1) < $iLine Then Return SetError(1, 0, 0) FileClose($aFile) Local $fil = FileOpen($sFile, 2) If $fil = -1 Then Return SetError(3, 0, 0) For $i = 1 To UBound($filtxt) - 1 If $i = $iLine Then FileWrite($fil, "") ElseIf $i < UBound($filtxt, 1) - 1 Then FileWrite($fil, $filtxt[$i] & @CRLF) ElseIf $i = UBound($filtxt, 1) - 1 Then FileWrite($fil, $filtxt[$i]) EndIf Next FileClose($fil) Return 1 EndFunc ;==>_FileRemoveLine GL all My Scripts:IE New UDFsElastic images moving under mouse (with a happy valentine's example)_FileRemoveLine Link to comment Share on other sites More sharing options...
Developers Jos Posted April 7, 2009 Developers Share Posted April 7, 2009 this is an easy function for line removing since i didnt find any when i was looking for oneRemarksIf _FileWriteToLine is called with $fOverWrite as 1 and $sText as "", it will delete the line. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
yehia Posted April 7, 2009 Author Share Posted April 7, 2009 oh i remember it was adding a @crlf so it wasnt removing the line but just making it empty My Scripts:IE New UDFsElastic images moving under mouse (with a happy valentine's example)_FileRemoveLine 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