faustf Posted January 23, 2015 Share Posted January 23, 2015 hi guy i have questions i saw is possible read line by line , and write line by line , but how is possible cancel line by line ?? i must write in the same line a blank line ?? if yes what is a command for tell at autoit , blanck line?? thankz at all Link to comment Share on other sites More sharing options...
kylomas Posted January 24, 2015 Share Posted January 24, 2015 Not enough info... How big is the file? Do you want to delete the line or blank it out (two very different things)? Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
faustf Posted January 25, 2015 Author Share Posted January 25, 2015 suppose you have this file txt www.mysite.comindex.html www.mysite.comindex.html www.mysite.comindex.html www.mysite.comindex.html i want cancel the first line how is possible do ??? thankz Link to comment Share on other sites More sharing options...
JohnOne Posted January 25, 2015 Share Posted January 25, 2015 _FileWriteToLine See help file for details. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
TheSaint Posted January 25, 2015 Share Posted January 25, 2015 Providing you know what line number, do as JohnOne suggested. If not, then you may need to use line testing and writing to another file, which gets renamed to the original afterward. With a uniquely named line, you could just use _ReplaceStringInFile All options above, bearing in mind, what kylomas asked too. Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) Link to comment Share on other sites More sharing options...
faustf Posted January 25, 2015 Author Share Posted January 25, 2015 (edited) hi guy at end i have birth this code , for me, work good, but probably is not good style if someone want corret is welcome Func _File_DeleteLine_Shift($path, $line) If $line = "" Then $line = 1 EndIf _FileReadToArray($path, $aArray) Local $iDelete = FileDelete($path) $file = FileOpen($path, 1) If @error Then MsgBox($MB_SYSTEMMODAL, "", "There was an error reading the file. @error: " & @error) ; An error occurred reading the current script file. Else For $i = 0 To UBound($aArray) - 1 ; Loop through the array. If $i = $line Then ;MsgBox (0,'', $aArray[$i]) Else If $aArray[$i] = 34 Then Else FileWrite($file, $aArray[$i] & @CR) EndIf EndIf Next EndIf ; Close the handle returned by FileOpen. FileClose($file) EndFunc ;==>_File_DeleteLine_Shift thankz at all Edited January 25, 2015 by faustf 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