yeto Posted July 4, 2019 Posted July 4, 2019 #include <AutoItConstants.au3> Global $hour, $min, $sec, $msec While 1 ;endless loop so script will continually check computer clock/time Sleep(100) WEnd $hour = @HOUR $min = @MIN If @HOUR = 07 And @MIN = 22 Then ;time to fire beep Beep (500, 3000) EndIf HotKeySet("{ESC}", "On_Exit") ;quick way out if something goes wrong Func On_Exit() Exit EndFunc When computer clock hits set time I am not hearing a beep. Also, in the AutoIt icon in the task tray I am seeing that the script is paused. Would anyone have some suggestions as to what I am doing incorrectly? Thank you in advance for any help, yeto
Earthshine Posted July 4, 2019 Posted July 4, 2019 (edited) It’s probably because you’re stuck in the while loop sleeping. This is getting really annoying. You need to add debugging code to your programs Edited July 4, 2019 by Earthshine My resources are limited. You must ask the right questions
Simpel Posted July 4, 2019 Posted July 4, 2019 Hi, try (currently untested): HotKeySet("{ESC}", "On_Exit") ;quick way out if something goes wrong While 1 ;endless loop so script will continually check computer clock/time Sleep(100) If @HOUR = 07 And @MIN = 22 Then ;time to fire beep Beep (500, 3000) EndIf Wend Func On_Exit() Exit EndFunc Hotkeyset at the beginning. Wenn at the end of the Loop including the if clause. Regards, Simpel SciTE4AutoIt = 3.7.3.0 AutoIt = 3.3.14.2 AutoItX64 = 0 OS = Win_10 Build = 19044 OSArch = X64 Language = 0407/german H:\...\AutoIt3\SciTE H:\...\AutoIt3 H:\...\AutoIt3\Include (H:\ = Network Drive) Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind.
yeto Posted July 4, 2019 Author Posted July 4, 2019 54 minutes ago, Simpel said: Hi, try (currently untested): HotKeySet("{ESC}", "On_Exit") ;quick way out if something goes wrong While 1 ;endless loop so script will continually check computer clock/time Sleep(100) If @HOUR = 07 And @MIN = 22 Then ;time to fire beep Beep (500, 3000) EndIf Wend Func On_Exit() Exit EndFunc Hotkeyset at the beginning. Wenn at the end of the Loop including the if clause. Regards, Simpel Yes, thank you, that worked. If you have time for teaching why did having HotKey at end prevent script from working? Also, am I correct in my line of thinking that I need the continually loop so that the script will keep checking the computer clock so as to know when to beep? Thank you for taking time to help, yeto
FrancescoDiMuro Posted July 4, 2019 Posted July 4, 2019 11 minutes ago, yeto said: why did having HotKey at end prevent script from working? The code is executed line by line, so, if you put something that will cause the program to idle, you can't use something that is declared or executed further Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette
yeto Posted July 4, 2019 Author Posted July 4, 2019 55 minutes ago, FrancescoDiMuro said: The code is executed line by line, so, if you put something that will cause the program to idle, you can't use something that is declared or executed further Thank you. That is helpful. I saw a post that said ScriptWriter is good to use. I am currently using SciTE. Would you reccomend that a newbie use ScriptWriter (which I couldn't find in the download)?
FrancescoDiMuro Posted July 4, 2019 Posted July 4, 2019 (edited) @yeto Never tried ScriptWriter, but feel free to try it. IMHO, SciTE is a very good and powerful too to write AutoIt code Edited July 4, 2019 by FrancescoDiMuro Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette
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