Jump to content
Sign in to follow this  
lolp1

Need help detecting a new line.

Recommended Posts

lolp1

Ok, here is what I need to do.

Lets say I log something to a file, every time it logs it of course makes a new line.

1

2

3

4

etc

I need a way to detect every time it logs a new line, so I can report what it logged to another place, how could I do this?

Share this post


Link to post
Share on other sites
lolp1

Thanks, works!

I came up with this, the problem is I now need to report the latest line logged, and I need to report the actual log line, for example instead of it reporting Log.txt108, I need it to report like:

2007-05-01 20:13:08 : Text 1

Any idea :)?

#include <File.au3>
#include <IRC.au3>
Global $server = "irc.gamersvault.net"
Global $port = 6667
Global $nick = "Au3Bot"
Global $channel = "#xferbot"

$Log = "Log.txt"
$CountLines = _FileCountLines($Log)
TCPStartup ()
Global $sock = _IRCConnect($server, $port, $nick); Connects to IRC and Identifies its Nickname
;$recv = TCPRecv($sock, 8192); Recieve things from server
_IRCJoinChannel ($sock, $channel)
While 1
    
            
    $nCountLines = _FileCountLines($Log)
   
    If $nCountLines <> $CountLines Then
          _IRCSendMessage($sock, $log & $ncountlines, $channel)
        $CountLines = $nCountLines
    EndIf
    Sleep(20)
    
WEnd

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×