d4rkm3n Posted January 5, 2005 Posted January 5, 2005 (edited) Hi!This script, connects to IRC and writes a log file. It joins the channel #dc.de.The problem now is to get one word form the topic which changes daily.* Topic is '2[4 Hot Ip's: .54/1603/1648 [45]2] [12 Cold Ip's: .58/886/924 [38] 2] [ Walked Ip's: .235 .230 .42 2] [ Forum: www.diabloclone.com ]'I want to get the number after "Hot Ip's: .", in this case the 54.expandcollapse popupwhile (1) RUN ("cmd.exe") Sleep(1000) SEND ('cd{ENTER}') Sleep(1000) SEND ('telnet -f C:\irclog.txt irc.quakenet.org 6667{ENTER}') ; User Sleep(3000) Send("USER IRCTEST1 0 0 IRC TESTER{ENTER}") ; NICK Send("NICK IRCTESTX-{ENTER}") Sleep(1000) Pong () Sleep(1000) sleep (4000) exit wend ;================================ Func PONG () $pongline = FileReadLine ( 'C:\irclog.txt', 7 ) Send( "PONG " & $pongline & "{ENTER}" ) Sleep(5000) Send( "JOIN {#}dc.de{ENTER}") Return EndFuncHow can i read the only number from the txt file? Edited January 5, 2005 by d4rkm3n
Blue_Drache Posted January 5, 2005 Posted January 5, 2005 (edited) CODE $file = "C:\IRC\log.txt" $test = FileOpen($file, 0) If $test = -1 Then MsgBox(0, "", "Unable to open file.") Exit EndIf While 1 $line = FileReadLine($file) If @error = -1 Then ExitLoop If StringInStr($line, "Hot Ip's: .") <> "" Then MsgBox(0, "", "Hot IP is:" & StringRight(StringMid($line, StringInStr($line, "Hot Ip's: ."), 13), 2)) EndIf WEnd FileClose($file) FileDelete($file) Exit Hope that helps. Edit: Added file cleanup. Edited January 5, 2005 by Blue_Drache Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache
d4rkm3n Posted January 5, 2005 Author Posted January 5, 2005 CODE$file = "C:\IRC\log.txt"$test = FileOpen($file, 0)If $test = -1 Then MsgBox(0, "", "Unable to open file.") ExitEndIfWhile 1 $line = FileReadLine($file) If @error = -1 Then ExitLoop If StringInStr($line, "Hot Ip's: .") <> "" Then MsgBox(0, "", "Hot IP is:" & StringRight(StringMid($line, StringInStr($line, "Hot Ip's: ."), 13), 2)) EndIfWEndFileClose($file)FileDelete($file)Exitits not working....i think i dont find the line...( i edit the irclog.txt and wrote only in the first line Hot Ip's: .01 and thos worked )
Blue_Drache Posted January 5, 2005 Posted January 5, 2005 its not working....i think i dont find the line...( i edit the irclog.txt and wrote only in the first line Hot Ip's: .01 and thos worked )<{POST_SNAPBACK}>Try toying with this line:MsgBox(0, "", "Hot IP is:" & StringRight(StringMid($line, StringInStr($line, "Hot Ip's: ."), 13), 2))Specifically everything after the first & sign. That's the meat of the whole thing there. I may not have enough characters. I didn't post tested code, merely something out of the top of my head to try and jump you in the right direction. I won't be able to test it for another 4 hours when I'm at my house. Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache
d4rkm3n Posted January 5, 2005 Author Posted January 5, 2005 its not working....i think i dont find the line...( i edit the irclog.txt and wrote only in the first line Hot Ip's: .01 and thos worked )i meantits not working....i think IT DOESNT find the line...
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