Two Plus Two Newer Archives  

Go Back   Two Plus Two Newer Archives > Internet Gambling > Software
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 04-29-2007, 04:25 PM
chickenbeaks chickenbeaks is offline
Senior Member
 
Join Date: Oct 2004
Posts: 125
Default AHK FileReadLine

How can I use FileReadLine to read the last line in a text file?
Reply With Quote
  #2  
Old 04-29-2007, 04:37 PM
_dave_ _dave_ is offline
Senior Member
 
Join Date: Feb 2005
Location: UK
Posts: 2,628
Default Re: AHK FileReadLine

Assuming you do not know in advance how many lines the file contains, not by using FileReadLine [img]/images/graemlins/smile.gif[/img]

At a quick glance, the AHK documentation suggest this snippet:

<font class="small">Code:</font><hr /><pre>
<font color="green">; Example #2: Retrieve the last line from a text file.</font>
Loop, read, C:\Log File.txt
last_line := A_LoopReadLine <font color="green">; When loop finishes, this will hold the last line.</font>
</pre><hr />

http://www.autohotkey.com/docs/comma...opReadFile.htm

How efficient this is I do not know, maybe not very for large files, in which case reading the whole thing then StringTrimLeft to chop it to the last line may be better, although I really have no idea [img]/images/graemlins/smile.gif[/img]

Good luck,

dave.
Reply With Quote
  #3  
Old 04-30-2007, 02:07 AM
chickenbeaks chickenbeaks is offline
Senior Member
 
Join Date: Oct 2004
Posts: 125
Default Re: AHK FileReadLine

Thanks Dave. All is running smoothly now.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 01:19 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.