LazyCoder Posted August 27, 2013 Posted August 27, 2013 I made a little script to remind me, every 2 hours, to drink (yes, I'm the camel kind of programmer...) thanks to a pop-up. But at some point, my computer went to sleep mode. OK. Nothing strange there. But when the computer woke up, I was expecting the pop-up to show. But nothing. It came later. So I guess the timer is a local count of CPU cycles?! But did I hit something: I happened not to have the pop-up in the defined "timer time" or at all. I'm having trouble to reproduce this issue, so I'm looking for some more information about timer behavior. Anyone? A good program computing A into B is mostly one that won't crash in all the other cases...
JohnOne Posted August 27, 2013 Posted August 27, 2013 You're doing it wrong. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
LazyCoder Posted August 27, 2013 Author Posted August 27, 2013 Very helpfull... Someone else? A good program computing A into B is mostly one that won't crash in all the other cases...
BrewManNH Posted August 27, 2013 Posted August 27, 2013 He's sarcastically telling you that we need to see your code to make any kind of rational answer valid. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator
LazyCoder Posted August 27, 2013 Author Posted August 27, 2013 (edited) How couldn't I get it?... Must be tired today. Here we go: HotKeySet("^{F9}", "Terminate") Func Terminate() Exit EndFunc ;==>Terminate ;;;;;;;;;;;;;;;;;;;;;;;;; ; MAIN ;;;;;;;;;;;;;;;;;;;;;;;;; $iDelay = 7200000 ; 2h = 7200000 ms $tBegin = TimerInit() $tDiff = 0 While (1) If $tDiff > $iDelay Then MsgBox(48, "REMINDER", 'Get-Water("Fontain") !!!!!') $tBegin = TimerInit() ; reinit timer for next pop-up EndIf Sleep(1) $tDiff = TimerDiff($tBegin) WEnd Quite simple... Edited August 27, 2013 by LazyCoder A good program computing A into B is mostly one that won't crash in all the other cases...
JohnOne Posted August 27, 2013 Posted August 27, 2013 Perhaps you should make your function geared more toward the actual time rather than difference. Pseudo. When script starts, get the current time. Calculate the time two hours from that, and test calculated time against current time every minute or whatever. Loop AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
LazyCoder Posted August 27, 2013 Author Posted August 27, 2013 I think I will. But I like to understand how things work. Now I know I can manage "human" elapsed time and CPU elapsed time using system date/hour and timers. Good to know. Thanks a lot. A good program computing A into B is mostly one that won't crash in all the other cases...
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