Xander Posted September 6, 2005 Share Posted September 6, 2005 (edited) 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 1Do $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 September 6, 2005 by Xander Link to comment Share on other sites More sharing options...
AutoChris Posted September 6, 2005 Share Posted September 6, 2005 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 More sharing options...
Xander Posted September 7, 2005 Author Share Posted September 7, 2005 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 badWend Link to comment Share on other sites More sharing options...
Valuater Posted September 7, 2005 Share Posted September 7, 2005 (edited) 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 September 7, 2005 by Valuater Link to comment Share on other sites More sharing options...
Xander Posted September 7, 2005 Author Share Posted September 7, 2005 Seems to be working 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 ) 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 More sharing options...
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