Jump to content

Flakey internet connection


Xander
 Share

Recommended Posts

I'm sure it's staring me right in the face. I've recently moved and, while waiting on my ISP to fix it on their end, I'm dealing with an intermittent connection. I want my script to tell me when the connection's status changes -- but not just tell me every 30secs.

Loop1

....Loop2--Stay here while connection is down

........play a happy sound when exiting

....Loop3--Stay here while connection is up

........Play a bad sound when exiting

^^That make enough sense?

While 1

Do

$var = ping("64.233.161.104",300)

Sleep(30000)

Until $var=0

SoundPlay("E:\Sounds\Bells2.wav",1)

Do

$var = ping("64.233.161.104",300)

Sleep(30000)

Until $var <> 0

SoundPlay("E:\Sounds\nelson_haha.wav",1)

WEnd

Edited by Xander
Link to comment
Share on other sites

I'm sure it's staring me right in the face.  I've recently moved and, while waiting on my ISP to fix it on their end, I'm dealing with an intermittent connection.  I want my script to tell me when the connection's status changes -- but not just tell me every 30secs.

Loop1

....Loop2--Stay here while connection is down

........play a happy sound when exiting

....Loop3--Stay here while connection is up

........Play a bad sound when exiting

^^That make enough sense?

<{POST_SNAPBACK}>

How about this...?

$var = ping("64.233.161.104",300)
While 1
  If $var <> 0 Then
    SoundPlay("E:\Sounds\Bells2.wav",1)
    Sleep(30000)
  ElseIf
    $var = 0 Then
    SoundPlay("E:\Sounds\nelson_haha.wav",1)
    Sleep(30000)
  EndIf
WEnd
Link to comment
Share on other sites

About the same - it just reports with sound whether it's a good or bad connection, every 60 seconds.

What I'm trying to work out is how to get it to stay in each respective loop until the status changes.

While

... Loop while connection is good

... Loop while connection is bad

Wend

Link to comment
Share on other sites

maybe this

While 1
    $var = ping("64.233.161.104",300)
    
    If $var <> 0 Then
        SoundPlay("E:\Sounds\Bells2.wav",1)
        While $var <> 0 
            Sleep(30000)
            $var = ping("64.233.161.104",300)
        WEnd
    ElseIf $var = 0 Then
        SoundPlay("E:\Sounds\nelson_haha.wav",1)
        While $var = 0
            Sleep(30000)
            $var = ping("64.233.161.104",300)
        WEnd
    EndIf
WEnd

revised serialkillers code

8)

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

Seems to be working :dance:

Threw in a couple of tray tweaks so that if I'm out of the room, I can tell at a quick check if it's up or down (without sticking my head under my desk to see the blinking DSL light on the router :whistle: ) Incidentally, the compiler (and SciTe) didn't seem to recognize the Tray commands I added, but they're working fine.

maybe this

#Include <Constants.au3>
TraySetState() ;only included because it was in the demo script.

While 1
    $var = ping("64.233.161.104",300)
    
    If $var <> 0 Then
        SoundPlay("E:\Sounds\xylup.wav",1)
        While $var <> 0
            Sleep(30000)
            $var = ping("64.233.161.104",300)
    [b]TraysetToolTip("CONNECTION GOOD")
    TraySetIcon("E:\Icons\Flag_green.ico")[/b]
        WEnd
    ElseIf $var = 0 Then
        SoundPlay("E:\Sounds\Xyldown.wav.wav",1)
        While $var = 0
            Sleep(30000)
            $var = ping("64.233.161.104",300)
    [b]TraysetToolTip("CONNECTION BAD")
    TraySetIcon("E:\Icons\Flag_red.ico")[/b]
        WEnd
    EndIf
WEnd

<{POST_SNAPBACK}>

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