Jump to content

is there way?


Recommended Posts

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.

while (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

EndFunc

How can i read the only number from the txt file?

Edited by d4rkm3n
Link to comment
Share on other sites

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 by Blue_Drache

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Link to comment
Share on other sites

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

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 )

Link to comment
Share on other sites

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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...