t0ddie Posted December 19, 2004 Share Posted December 19, 2004 (edited) this works pretty good, and its accurately 60 seconds. $x = 60 for $z = 1 to 60 sleep (500) splashtexton ("OPPONENT HAS RESIGNED!","waiting 60 seconds..... " & $x,250,30,700,350) mousemove(400,400,0) $x = $x - 1 sleep (500) mousemove(300,300,0) Next but i want to log the time i stay idle, and the script is in a do until loop doing other things besides just sleeping, pretty much, this is what i have going on in the do until loop $min = 10 $sec = 0 $time = 0 Do $sec = $sec + 1 If $sec = 10 Then $time = "" EndIf If $sec = 60 Then $sec = 0 $time = 0 $min = $min + 1 EndIf splashtexton ("STUBBORN OPPONENT!","idle time exceeded" & @CR & "moving mouse to avoid timeout" & @CR & _ "waiting for opponent to resign....." & @CR & @CR & "IDLE TIME " & $min & ":" & $time & $sec & @CR & @CR & _ "HIGH ROLLER is running!" & @CR & "press ESC to exit at any time.",250,170,700,350) mousemove(400,400,0) sleep(950) mousemove(300,300,0) $away = pixelgetcolor (193,505) Until $away = 15695363 anyways, it looks like a second to the human eye.. you can see i changed the sleep in this example from 1000 to 950. thats because when i run this script at 1000, it seems to be 3 seconds off according to my computer clock here. but i cant get the time exactly right. is there a way i can have a seperate function running.. keeping track of the time.. at the same time my script is running without making a second script? because the commands in the do until loop are taking up some time, and making the counter not accurate, and it seems silly to try to find some sleep time that will work, like 932.637647659 thanks in advance for the suggestions. T0ddie Edited December 19, 2004 by t0ddie Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you. Link to comment Share on other sites More sharing options...
Developers Jos Posted December 19, 2004 Developers Share Posted December 19, 2004 just use TimerInit() and TimerDiff() to get the exact timing.... 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...
t0ddie Posted December 19, 2004 Author Share Posted December 19, 2004 hmmm, im expecting exactly 3000 milliseconds. from the help file $begin = TimerInit() sleep(3000) $dif = TimerDiff($begin) msgbox(0,"Time Difference",$dif) my result 2991.21871634523 is this a bug? Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you. Link to comment Share on other sites More sharing options...
Administrators Jon Posted December 19, 2004 Administrators Share Posted December 19, 2004 Sleep isn't 100% accurate. Usually accurate to 10-50ms - possibly more if the system is under heavy load. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
t0ddie Posted December 19, 2004 Author Share Posted December 19, 2004 thanks jon well, since thats not going to work,... how about this. is there someway to get the internal time of the clock on your computer..... then do your thing.... then get the time again.... and figure out the difference? seems reliable.... suggestions? Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you. Link to comment Share on other sites More sharing options...
Developers Jos Posted December 19, 2004 Developers Share Posted December 19, 2004 I was more thinking using it like this: $begin = TimerInit() For $x = 1 To 5 While TimerDiff($begin) < $x * 3000 Sleep(1) Wend MsgBox(0, "Time Difference", TimerDiff($begin),1) Next 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...
t0ddie Posted December 19, 2004 Author Share Posted December 19, 2004 (edited) noted jdb but, is there a way to get the time on your computer? like when you create a file... in properties... it tells you the time it was created. can i "check" the time on my computer in a certain place in the script, and check it again later? heck, can the computer time even be obtained with autoit? Edited December 19, 2004 by t0ddie Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you. Link to comment Share on other sites More sharing options...
Developers Jos Posted December 19, 2004 Developers Share Posted December 19, 2004 noted jdbbut, is there a way to get the time on your computer? like when you create a file... in properties... it tells you the time it was created.can i "check" the time on my computer in a certain place in the script, and check it again later?heck, can the computer time even be obtained with autoit?<{POST_SNAPBACK}> ofcourceever seen these macro's: @SEC @MIN @HOUR ??????? 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...
SlimShady Posted December 19, 2004 Share Posted December 19, 2004 noted jdbbut, is there a way to get the time on your computer? like when you create a file... in properties... it tells you the time it was created.can i "check" the time on my computer in a certain place in the script, and check it again later?heck, can the computer time even be obtained with autoit?<{POST_SNAPBACK}>http://www.autoitscript.com/autoit3/docs/m...TimeAndDate.htm Link to comment Share on other sites More sharing options...
t0ddie Posted December 19, 2004 Author Share Posted December 19, 2004 sweet. msgbox(0,"test", @hour & " " & @min & " " & @sec) thanks. you rule Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you. Link to comment Share on other sites More sharing options...
t0ddie Posted December 19, 2004 Author Share Posted December 19, 2004 (edited) well, this seems to be working pretty good so far. $hour_now = @HOUR $min_now = @MIN $sec_now = @SEC Do $hour_after = @HOUR $min_after = @MIN $sec_after = @SEC $hour = "" if $min_after - $min_now > 59 then $hour = $hour_after - $hour_now & ":" endif if $sec_after - $sec_now < 10 then $sec = "0" & $sec endif $min = $min_after + 10 - $min_now $sec = $sec_after - $sec_now splashtexton ("STUBBORN OPPONENT!","idle time exceeded" & @CR & "moving mouse to avoid timeout" & @CR & _ "waiting for opponent to resign....." & @CR & @CR & "IDLE TIME:" & @CR & $hour & $min & ":" & $sec & @CR & @CR & _ "HIGH ROLLER is running!" & @CR & "press ESC to exit at any time.",250,190,700,350) sleep(100) $away = pixelgetcolor (193,505) ; coordinates of lower left corner of large orange resignation/away box. Until $away = 15695363 it starts you off at 10 minutes. the problem is, while its counting, depending on what second your computer clock is on... it will do something like this. 10:51 10:52 10:53 10:54 10:55 11:-4 11:-3 11:-2 11:-1 heres where i am so far as you can see, its not the way i intended to display the info. but it seems to be working for the most part. im trying to make it so that $hours doesnt even display until its been an hour. and im also trying to make the seconds display like this 01 02 03 04 05 06 07 08 09 instead of 1 2 3 4 5 6 7 8 9 i could rack my brain for a few hours, but i thought i would ask for a quick fix here please, guide me. besides i need to take a break. i have been working on this script in its entirety for olmost 2 weeks lol thanks for your time and your brain Todd Edited December 19, 2004 by t0ddie Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you. Link to comment Share on other sites More sharing options...
Developers Jos Posted December 19, 2004 Developers Share Posted December 19, 2004 StringFormat("%02i:%02i:%02i", $Hour, $Mins, $Secs) 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...
t0ddie Posted December 20, 2004 Author Share Posted December 20, 2004 ??? $hour_now = @HOUR $min_now = @MIN $sec_now = @SEC Do $hour_after = @HOUR $min_after = @MIN $sec_after = @SEC $hour = "" if $min_after - $min_now > 59 then $hour = $hour_after - $hour_now & ":" endif if $sec_after - $sec_now < 10 then $sec = "0" & $sec endif $min = $min_after + 10 - $min_now $sec = $sec_after - $sec_now StringFormat("%02i:%02i:%02i", $hour, $min, $sec) splashtexton ("STUBBORN OPPONENT!","idle time exceeded" & @CR & "moving mouse to avoid timeout" & @CR & _ "waiting for opponent to resign....." & @CR & @CR & "IDLE TIME:" & @CR & $hour & $min & ":" & $sec & @CR & @CR & _ "HIGH ROLLER is running!" & @CR & "press ESC to exit at any time.",250,190,700,350) sleep(100) $away = pixelgetcolor (193,505) ; coordinates of lower left corner of large orange resignation/away box. Until $away = 15695363 i dont see what that did... Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you. Link to comment Share on other sites More sharing options...
Developers Jos Posted December 20, 2004 Developers Share Posted December 20, 2004 ???-snip-i dont see what that did...<{POST_SNAPBACK}>you need to put it into your splashtexton ... something like:SplashTextOn("STUBBORN OPPONENT!", "idle time exceeded" & @CR & "moving mouse to avoid timeout" & @CR & _ "waiting for opponent to resign....." & @CR & @CR & "IDLE TIME:" & StringFormat("%02i:%02i:%02i", $hour, $min, $sec) & @CR & @CR & _ "HIGH ROLLER is running!" & @CR & "press ESC to exit at any time.", 250, 190, 700, 350) 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...
kanumi Posted December 20, 2004 Share Posted December 20, 2004 (edited) It suggest calculation with the number of seconds. expandcollapse popup$last_passed_sec = -1 $day_start = @MDAY $hour_start = @HOUR $min_start = @MIN $sec_start = @SEC $start_secs = ( (@HOUR * 60) + @MIN) * 60 + @SEC HotKeySet("{ESC}", "Terminate") Do ;calculate the seconds passed by ;calculating here is only valid up to 24 hours! If @MDAY <> $day_start Then $passed_secs = 24 * 60 * 60 Else $passed_secs = 0 EndIf $passed_secs = $passed_secs - $start_secs + ( (@HOUR * 60) + @MIN) * 60 + @SEC $hour_passed = Int($passed_secs / 3600) $passed_secs = Mod($passed_secs, 3600) $min_passed = Int($passed_secs / 60) $sec_passed = Mod($passed_secs, 60) ;just to avoid unnecessary updates - flickering If $last_passed_sec <> $passed_secs Then $last_passed_sec = $passed_secs $my_timestr = StringFormat("%02i:%02i:%02i", $hour_passed, $min_passed, $sec_passed) SplashTextOn("STUBBORN OPPONENT!", "idle time exceeded" & @CR & "moving mouse to avoid timeout" & @CR & _ "waiting for opponent to resign....." & @CR & @CR & "IDLE TIME:" & @CR & $my_timestr & @CR & @CR & _ "HIGH ROLLER is running!" & @CR & "press ESC to exit at any time.", 250, 190, 700, 350) EndIf Sleep(100) $away = PixelGetColor(193, 505); coordinates of lower left corner of large orange resignation/away box. Until $away = 15695363 Exit 0 Func Terminate() Exit 0 EndFunc ;==>Terminate Edited December 20, 2004 by kanumi Link to comment Share on other sites More sharing options...
t0ddie Posted January 1, 2005 Author Share Posted January 1, 2005 ty kanumi how would i make it start out at 10 minutes? Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you. Link to comment Share on other sites More sharing options...
t0ddie Posted January 2, 2005 Author Share Posted January 2, 2005 ANYONE? Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you. Link to comment Share on other sites More sharing options...
DirtyBanditos Posted January 2, 2005 Share Posted January 2, 2005 (edited) ANYONE?<{POST_SNAPBACK}> Hi adde to your script this and idit it for the sleep time. Idit it for your setting`s i hope it help. Ps: and make a reaped or loop to restart i all 10 minutes.Sleep(90000) Run(@WindowsDir & "\Media\tada.wav", 1) ;or you like this Sleep(90000) Run(@ScriptDir & "\Media\tada.wav", 1) ;or you like this :D $begin = TimerInit() For $x = 1 To 5 While TimerDiff($begin) < $x * 3000 Sleep(1) Wend MsgBox(0, "Time Difference", TimerDiff($begin),1) Next Edited January 2, 2005 by DirtyBanditos 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