Jump to content

Timer and IP checker


Recommended Posts

i can't make it working

the program must check the ip every min

$IP1= "121.128.133."
$IP2= "222.111.176."

        While 1
    Sleep(100)
    ;;;;;;;;;;;;;;;;;$stringTimer = StringIsAlNum($timer2)
    ;;;;;;;;;;;;;;;;;;;;;If $stringTimer = 1 Then
        If TimerDiff($timer2) > 1*60*1000 Then
            $button1()
        EndIf
    EndIf
    WEnd

Func dcchecker()
While 1
    $STRING = "leerer string"
    $FOO = Run(@ComSpec & " /c netstat -n", @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
    While 1
        $LINE = StdoutRead($FOO)
        If @error Then ExitLoop
        $STRING = $STRING & $LINE
    WEnd
    
    If (StringInStr($STRING, $IP1) <> 0) Or (StringInStr($STRING, $IP2) <> 0) Then
        $timer = TimerInit()
    Else
            While (ProcessExists("sro_client.exe"))
                Sleep(1000)
                ProcessClose("sro_client.exe")
                Sleep(5000)
            WEnd
    EndIf
    EndSwitch
WEnd
endfunc

does somebody see whats wrong ?

thx

Edited by tommeke228
Link to comment
Share on other sites

This is a silly check:

$stringTimer = StringIsAlNum($timer2)

If $stringTimer = 1 Then

If TimerDiff($timer2) > 1*60*1000 Then

This would allow $timer2 to have alphabet characters in it. Don't even bother with this check.

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...