some1 Posted July 14, 2007 Share Posted July 14, 2007 Hi I'm making a Internet connection monitor. On my gui, I need to be able to set the time between connection attemps. I have tried with: While $Monitoring = 1 ;;alot of code Sleep ( $Interval ) but the interval is not the same value as $Interval... Only when I put in a number (like 5000), there is a delay... Can it be done this way??? Or if not, would you be so kind to tell me how to do it right thx Link to comment Share on other sites More sharing options...
Developers Jos Posted July 14, 2007 Developers Share Posted July 14, 2007 Hi I'm making a Internet connection monitor. On my gui, I need to be able to set the time between connection attemps. I have tried with: While $Monitoring = 1 ;;alot of code Sleep ( $Interval ) but the interval is not the same value as $Interval... Only when I put in a number (like 5000), there is a delay... Can it be done this way??? Or if not, would you be so kind to tell me how to do it right thxShould work ...what is the problem you are seeing ? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Phat Phil Posted July 14, 2007 Share Posted July 14, 2007 For sleep times I do something like this to make a random sleep between x1 and x2 numbers. $sleep = Random(5000,6000) Sleep($sleep); sleeps between 5 and 6 seconds hope that helps. Link to comment Share on other sites More sharing options...
some1 Posted July 14, 2007 Author Share Posted July 14, 2007 (edited) what is the problem you are seeing?There is no sleep-time... its like i have just entered: sleep () For sleep times I do something like this to make a random sleep between x1 and x2 numbers. $sleep = Random(5000,6000) Sleep($sleep); sleeps between 5 and 6 seconds hope that helps. I am really glad about the help commin' in so fast, but the thing I want to do, is to put in a sleep-time in the gui, not just have a random sleep-time. Edited July 14, 2007 by some1 Link to comment Share on other sites More sharing options...
Phat Phil Posted July 14, 2007 Share Posted July 14, 2007 oh sorry im not very good at autoit jus learning.dun no ne thing about gui. im still trying to figure out how 2 make it where the script will relise that the monster im attacking is dead -.- that way i dont have 2 time how long it usally takes me 2 kill it and hope its dead by then. Link to comment Share on other sites More sharing options...
Developers Jos Posted July 14, 2007 Developers Share Posted July 14, 2007 (edited) There is no sleep-time... its like i have just entered: sleep () I am really glad about the help commin' in so fast, but the thing I want to do, is to put in a sleep-time in the gui, not just have a random sleep-time. Show what your are doing and be a bit more clear in the problem description. Sleep($time) will work when $time contains the time to pause in ms. Edited July 14, 2007 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
ashley Posted July 14, 2007 Share Posted July 14, 2007 Hi I'm making a Internet connection monitor. On my gui, I need to be able to set the time between connection attemps. I have tried with: While $Monitoring = 1 ;;alot of code Sleep ( $Interval ) but the interval is not the same value as $Interval... Only when I put in a number (like 5000), there is a delay... Can it be done this way??? Or if not, would you be so kind to tell me how to do it right thx try this While $Interval = random(1000,9000) ; sleep between 1-9 secs ;;alot of code Sleep ( $Interval ) Free icons for your programs Link to comment Share on other sites More sharing options...
Developers Jos Posted July 14, 2007 Developers Share Posted July 14, 2007 try this While $Interval = random(1000,9000) ; sleep between 1-9 secs are you sure ? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
some1 Posted July 14, 2007 Author Share Posted July 14, 2007 ok, here is the code for my function: expandcollapse popup;;================================================================================ ;;Function ;;================================================================================ While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $CheckNow $Interval = GUICtrlRead($Interval) $IP = GUICtrlRead($IP) $IntervalReal = $Interval * 1000 Traytip ( $AppName, "Checking connection", 1500) $Ping = ping ( "209.166.161.121" ) MsgBox (0, $AppName, $Connection) Case $msg = $Monitor $Interval = GUICtrlRead($Interval) $IP = GUICtrlRead($IP) $IntervalReal = $Interval * 1000 $Monitoring = 1 Traytip ( $AppName, "Monitoring connection", 1500) While $Monitoring = 1 $msg = GUIGetMsg() If $msg = $CheckNow Then Traytip ( $AppName, "Checking connection", 1500) $Ping = ping ( "209.166.161.121" ) MsgBox (0, $AppName, $Connection) EndIf If $msg = $GUI_EVENT_CLOSE Then Exit EndIf If $msg = $Monitor Then $Monitoring = 0 EndIf $Ping = ping ( "209.166.161.121" ) MsgBox (0, $AppName, $Connection) MsgBox ( 0, $AppName, "Your Connection is being checked") [b]sleep ( $IntervalReal )[/b] WEnd EndSelect Wend The $Interval is filled in by the user in the gui... This value is then made to millisecs, and the Value put into $IntervalReal, Which is the sleep-value... Donøt worry about all the msgBox'es... it was just to see if the program even reacted to pressing buttons, and hotkeys (still learning) Link to comment Share on other sites More sharing options...
Developers Jos Posted July 14, 2007 Developers Share Posted July 14, 2007 (edited) you should not do this : $Interval = GUICtrlRead($Interval) I assume that $Interval contains the ControlHandle of the GuiCreateInput() and you overide it with its content ..... Use a different variablename for the read value and try again. Also for debugging, check the calculated value for $IntervalReal ... Edited July 14, 2007 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
some1 Posted July 14, 2007 Author Share Posted July 14, 2007 ok, will be back in ten minutes... Link to comment Share on other sites More sharing options...
some1 Posted July 14, 2007 Author Share Posted July 14, 2007 Damn... That did it Thx ALOT (to you all, Great Community) 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