Sign in to follow this  
Followers 0
magaf

searching an irc channel for a str

9 posts in this topic

could it be done with autoit and some external tool or any other idea?

Share this post


Link to post
Share on other sites



Yes, I have done a few of these. It depends on the client on how easy, or how hard it is to do.

If your client has an autolog (saves to a file as chat text comes in) you can just have AutoIt monitor that file. (see FileReadLine)

If your chat is a standard Window control, you can have AutoIt read that text by finding the control name with AutoIt window spy, and then ControlGetText.

You can also send a ^C to the window, or copy all the text, and then use a clipget() to grab it into autoit, and find your string.

I prefer to use the autolog search, I usually have it whipe the file first, or just read the file til the end, and have autoit get that line number, then have a loop read the lines as they come from then on.


AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

How would you get it to read only after XXX line?

Or would you have to read it to an aray EACH time?


"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.

Share this post


Link to post
Share on other sites

use filereadline.

Here is a slightly changed version of the help file that keeps track of each line#

$file = FileOpen("text.txt", 0)

; Check if file opened for reading OK
If $file = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf

; Read in lines of text until the EOF is reached
$x=1
While 1
    $line = FileReadLine($file,$x)
    If @error = -1 Then ExitLoop
    $x=$x+1
Wend

FileClose($file)
$line=FileReadLine("text.txt",$x-1)

msgbox(1,"There are curently " & $x-1 & " lines in text.txt last line is",$line)

you can have it loop and use the @error to notify you when it reaches the last line, and you can then pause a bit, and loop again, or what ever your fancy.


AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

Here is an example that will simply display the last line for ya:

$file = FileOpen("test.au3", 0)

; Check if file opened for reading OK
If $file = -1 Then
   MsgBox(0, "Error", "Unable to open file.")
   Exit
EndIf

; Read in lines of text until the EOF is reached
$x=1
While 1
   $line = FileReadLine("test.au3",$x)
   If @error = -1 Then ExitLoop
   $x=$x+1
Wend

FileClose($file)
$x=$x-1

While 1
    $line=FileReadLine("test.au3",$x)
    If @error =-1 Then ContinueLoop
    tooltip($x & "Last line is" & @CRLF & $line,0,0)
    $x=$x+1
Wend

AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

thx, my client does have a log file but with autoit scanning a large log file can take some time and resources, is there a program that autoit could use to do it with?

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

i think ill write it with python :) any better idea?

btw how do i make a hotkey in python and what import do i need?

Edited by magaf

Share this post


Link to post
Share on other sites

Not sure if the log file becomes large, or if it already large, in the case of already large, you could have it store the line to start in an ini file, so that it would not have to start at the beginning each time. AutoIt is a great program to automate all sorts of other aps, so you could have autoit control almost any other program. :)


AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

yeah autoit is very good but in this case i used python because its not much to write and its much more fast (the log file i was checking was about 350kb which took autoit a long while to find jsut how much line there were)

anyway i already built it in python works great:)

Edited by magaf

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  
Followers 0