Xtreme Developers

Would you like to react to this message? Create an account in a few clicks or log in to continue.

Xtreme Developers Forum!

Subscribe


2 posters

    IP Spider - Pinger

    Zibit
    Zibit
    Admin


    Posts : 21
    Exp : 26633
    Reputation : 6
    Join date : 2010-05-22
    Age : 31
    Location : Estonia

    IP Spider - Pinger Empty IP Spider - Pinger

    Post by Zibit Tue Jun 01, 2010 3:06 pm

    Now this is a example and very useful too... this shows how to do several function's at once.
    Code:
    #include <File.au3>
    #include <Constants.au3>
    $input = InputBox("RAM Limit", "Ram usage limit in percent ?", "50")
    $start = "0.0.0.0"
    $nr4 = 0
    if $input < 1 or $input > 100 then $input = 50
    if FileExists("InActive") = True then
       $count = _FileCountLines("InActive")
       $start = FileReadLine("InActive", $count)
       $split = StringSplit($start, ".", 1)
       $nr1 = 0
       $nr2 = 0
       $nr3 = 0
       if $split[4] <> 0 and $split[3] <> 0 then $nr1 = Number($split[3]*$split[4])
       if $split[2] <> 0 and $split[3] <> 0 then $nr2 = Number($split[2]*$split[3])
       if $split[1] <> 0 and $split[2] <> 0 then $nr3 = Number($split[1]*$split[2])
       $nr4 = Number($nr1+$nr2+$nr3)
       endif
    $ip = StringSplit($start, ".")
    $ip1 = $ip[1]
    $ip2 = $ip[2]
    $ip3 = $ip[3]
    $ip4 = $ip[4]
    $sleep = 100
    $maxip = 4228250625
    $max_proc = 30
    $max_ip = 50
    do
       $list = ProcessList("pinger.exe")
       $nr4 = $nr4 + 1
       if $list[0][0] > $max_proc then
          Do
             sleep(100)
             $list = ProcessList("pinger.exe")
             until $list[0][0] < $max_proc
          endif
       $done = Number($nr4/$maxip)
       $round = Round($done, 4)
       $ip5 = $ip1 & "." & $ip2 & "." & $ip3 & "." & $ip4
       $mem = MemGetStats()
       ToolTip($ip5 & @CRLF & "Available: " & $mem[2] & "/" & $mem[1] & @CRLF & "In Use: " & $mem[0] & " %" & @CRLF & "Done: " & $round & " %" & @CRLF & "IP's Checked from last time: " & $nr4, 0, 0)
       if $mem[0] > $input and $sleep < 300 then $sleep = $sleep + 50
       if $mem[0] < $input and $sleep > 10 then $sleep = $sleep - 50
       HotKeySet("{DEL}", "_exit")
       $func = getip($max_ip, $ip5)
       sleep($sleep)
       run('"' & @scriptDir & '\Pinger.exe" ' & $func, "", @SW_HIDE, $STDERR_CHILD)
       ConsoleWrite(getip($max_proc, $ip5) & @CRLF)
    until $ip5 = "255.255.255.255"
    func _exit()
       exit
    endfunc
    func getip($max_ip, $ip5)
       $i = 0
       $ip6 = $ip5 & " "
       Do
       $i = $i + 1
       $ip4 = $ip4 + 1
       if $ip2 = 255 then
          $ip2 = 0
          $ip1 = $ip1 + 1
       endif
       if $ip3 = 255 then
          $ip3 = 0
          $ip2 = $ip2 + 1
       endif
       if $ip4 = 255 then
          $ip4 = 0
          $ip3 = $ip3 + 1
       endif
       $ip5 = $ip1 & "." & $ip2 & "." & $ip3 & "." & $ip4
       $ip6 = $ip6 & $ip5 & " "
       Until $i = $max_ip
       Return $ip6
       EndFunc
    Code:
    #NoTrayIcon
    $i = 0
    Do
    $i = $i + 1
    $ping = Ping($CmdLine[$], 300)
    if $ping <> 0 then FileWriteLine("Active", $CmdLine[$i] & " - " & $ping & " ms")
    if $ping = 0 then FileWriteLine("InActive", $CmdLine[$i] & " - " & $ping & " ms")
       until $CmdLine[0] = $i

    PINGER MUST BE COMPILED!!!
    Code:
    avatar
    maakera
    Newbie
    Newbie


    Posts : 12
    Exp : 25961
    Reputation : 0
    Join date : 2010-09-19

    IP Spider - Pinger Empty Re: IP Spider - Pinger

    Post by maakera Sun Sep 19, 2010 9:19 am

    dont you just love AutoIt Razz
    Zibit
    Zibit
    Admin


    Posts : 21
    Exp : 26633
    Reputation : 6
    Join date : 2010-05-22
    Age : 31
    Location : Estonia

    IP Spider - Pinger Empty Re: IP Spider - Pinger

    Post by Zibit Sun Sep 19, 2010 9:21 am

    Yep the best ^^

    Sponsored content


    IP Spider - Pinger Empty Re: IP Spider - Pinger

    Post by Sponsored content


      Current date/time is Sun Nov 24, 2024 5:23 am