lolp1 Posted May 4, 2007 Posted May 4, 2007 Hello, I am currently using some code to get new lines of text from a window and report them to mIRC, how ever it doesnt do all I want it to. I need a way to be able to filter all messages out that come except ones with the word "baal" in it, and I'm not sure how to get it to work correctly. Any examples or suggestions are appreciated. Here is my code: AutoItSetOption("WinDetectHiddenText", 1) Opt("WinTitleMatchMode", 2) Global $title = "StealthBot v2.6 Revision 3" Global $ctrltext $ctrltext = WinGetText($title) While 1 Sleep(20) ;$ctrltext = WinGetText("[talibot, online in channel The Void] - StealthBot v2.6 Revision 3", "") If $ctrltext <> WinGetText($title) Then $ctrltext = WinGetText($title) ;MsgBox (0, "Text Added!", "A new line has been added" &@CRLF &$ctrltext) $string = StringSplit ($ctrltext, @LF, 1) For $n = $string[0] To 1 Step -1 If StringStripWS($string[$n],4) <> "" Then ;MsgBox (0, "Report", "The control has " & $string[0] & " lines." & @CRLF & "Last non-blank line: " & $string[$n]) ControlSend("mIRC - [#baal-west", "", "Edit1", $string[$n]) ; Replace "mIRC - [#baal-west" with the title of your mirc window of channel you want to spam to ControlSend("mIRC - [#baal-west", "", "Edit1", "{ENTER}") ExitLoop EndIf Next $ctrltext = WinGetText($title) EndIf WEnd
xcal Posted May 4, 2007 Posted May 4, 2007 If StringInStr($your_string, 'baal') Then ;;; do something with it EndIf How To Ask Questions The Smart Way
lolp1 Posted May 4, 2007 Author Posted May 4, 2007 Yes, I tried that but here is my problem. It returns the last line found on WinGetText that had "baal" in it. How ever, I need to only check against the last line, that way it doesn't report the same game every time some one types in chat over and over again ! Here is what I tried, how ever like I said, every time a new line is written it reports the last line on the entire screen found with the word baal in it, instead of checking against the line just said, and then if it has baal in it report, if not dont report. I can't seem to find out how to do what I need. (Here is what I tried) AutoItSetOption("WinDetectHiddenText", 1) Opt("WinTitleMatchMode", 2) Global $title = "StealthBot v2.6 Revision 3" Global $ctrltext $ctrltext = WinGetText($title) While 1 Sleep(20) ;$ctrltext = WinGetText("[talibot, online in channel The Void] - StealthBot v2.6 Revision 3", "") If $ctrltext <> WinGetText($title) Then $ctrltext = WinGetText($title) ;MsgBox (0, "Text Added!", "A new line has been added" &@CRLF &$ctrltext) $string = StringSplit ($ctrltext, @LF, 1) For $n = $string[0] To 1 Step -1 If StringStripWS($string[$n],4) <> "" and If StringInStr($$string[$n], 'baal') > 0 Then ;MsgBox (0, "Report", "The control has " & $string[0] & " lines." & @CRLF & "Last non-blank line: " & $string[$n]) ControlSend("mIRC - [#baal-west", "", "Edit1", $string[$n]) ; Replace "mIRC - [#baal-west" with the title of your mirc window of channel you want to spam to ControlSend("mIRC - [#baal-west", "", "Edit1", "{ENTER}") ExitLoop EndIf Next $ctrltext = WinGetText($title) EndIf WEnd MsgBox(0,"","If you see this, you fucked up")
xcal Posted May 4, 2007 Posted May 4, 2007 $split = StringSplit(StringStripCR($yourvarwiththetext), @LF) $thisisthelastline = $split[$split[0]] If StringInStr($lastline, 'baal') Then haveaparty() EndIf How To Ask Questions The Smart Way
lolp1 Posted May 4, 2007 Author Posted May 4, 2007 Does not appear to work... AutoItSetOption("WinDetectHiddenText", 1) Opt("WinTitleMatchMode", 2) Global $title = "StealthBot v2.6 Revision 3" Global $ctrltext $ctrltext = WinGetText($title) While 1 Sleep(20) ;$ctrltext = WinGetText("[talibot, online in channel The Void] - StealthBot v2.6 Revision 3", "") If $ctrltext <> WinGetText($title) Then $ctrltext = WinGetText($title) ;MsgBox (0, "Text Added!", "A new line has been added" &@CRLF &$ctrltext) $split = StringSplit(StringStripCR($ctrltext), @LF) $lastline = $split[$split[0]] If StringInStr($lastline, 'baal') Then ControlSend("mIRC - [#baal-west", "", "Edit1", $lastline ]); Replace "mIRC - [#baal-west" with the title of your mirc window of channel you want to spam to ControlSend("mIRC - [#baal-west", "", "Edit1", "{ENTER}") EndIf $ctrltext = WinGetText($title) EndIf WEnd MsgBox(0,"","If you see this, you fucked up"
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