iXX Posted December 12, 2013 Share Posted December 12, 2013 Hi! I would like to overwrite last (or one before) line in a text file. It looks that I could use "_FileWriteLineTo". But how to determine number of lines in such file? Is there some simple function for this and I dont see it? And, is there something for deleting last line? Thanks! Link to comment Share on other sites More sharing options...
Solution JohnOne Posted December 12, 2013 Solution Share Posted December 12, 2013 _FileCountLines Help file 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...
Moderators JLogan3o13 Posted December 12, 2013 Moderators Share Posted December 12, 2013 Not to mention, if you're wanting to append to the end of a text file, just use FileWriteLine and forget about the line numbers. The help file is your friend. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Valuater Posted December 12, 2013 Share Posted December 12, 2013 Line count... #include <File.au3> Local $ReadFile = "_FileReadToArrayTest.au3" Local $aRecords If Not _FileReadToArray($ReadFile, $aRecords) Then MsgBox(4096, "Error", " Error reading log to Array error:" & @error) Exit EndIf MsgBox(0, 'Records', $aRecords[0]) Link to comment Share on other sites More sharing options...
Valuater Posted December 12, 2013 Share Posted December 12, 2013 Use... _FileWriteFromArray($File, $a_Array [, $i_Base = 0 [, $i_UBound = 0 [, $s_Delim= "|"]]]) to write the file with $UBound set to remove the last line 8) Link to comment Share on other sites More sharing options...
iXX Posted December 12, 2013 Author Share Posted December 12, 2013 Thanks folks! I am just little blind... 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