CounterCraft Posted November 11, 2008 Share Posted November 11, 2008 Hi everyone! programmer wannabe here...I made this script with basic knowledge to keep me alert.I think it's fine as it is but I want opinion from experienced scripterswhile 1 = 1 $min = @MIN $sec = @SEC if $min = 0 thenif $sec = 0 Then Beep (1500, 1000) Sleep (1000) Beep (1500, 1000) Sleep (1000) Beep (1500, 1000) Sleep (1000) Beep (1500, 1000) Sleep (1000) Beep (1500, 1000) msgbox (0, "Time to turn outdoor sign?", "Is it time to turn on the outdoor sign?") Beep (1500, 1000) Sleep (1000) Beep (1500, 1000) Sleep (1000) Beep (1500, 1000) Sleep (1000) Beep (1500, 1000) Sleep (1000) Beep (1500, 1000) EndIfEndIf WEndIs it necessary for me to put $min = @MIN and $sec = @SEC after while 1 = 1? Link to comment Share on other sites More sharing options...
Andreik Posted November 11, 2008 Share Posted November 11, 2008 Hi everyone! programmer wannabe here... I made this script with basic knowledge to keep me alert. I think it's fine as it is but I want opinion from experienced scripters Is it necessary for me to put $min = @MIN and $sec = @SEC after while 1 = 1? Tell us what you want to do. PS: Is more simple to use directly if @MIN = 0 then and if @SEC = 0 then When the words fail... music speaks. Link to comment Share on other sites More sharing options...
CounterCraft Posted November 11, 2008 Author Share Posted November 11, 2008 Tell us what you want to do. PS: Is more simple to use directly if @MIN = 0 then and if @SEC = 0 then It makes beep sound and popup notice every hour so I don't forget to light up the outdoor sign Link to comment Share on other sites More sharing options...
Andreik Posted November 11, 2008 Share Posted November 11, 2008 It makes beep sound and popup notice every hour so I don't forget to light up the outdoor sign I understand, but a loop without sleep is not a good idea and in this case is possible that you can not catch the exact second 0. If you use only @MIN you know when is a new hour. This should be a code for what you want to do: While 1 If @MIN = "00" Then MySound() MsgBox(0, "Time to turn outdoor sign?", "Is it time to turn on the outdoor sign?") MySound() EndIf Sleep(25) WEnd Func MySound() Beep (1500, 1000) Sleep (1000) Beep (1500, 1000) Sleep (1000) Beep (1500, 1000) Sleep (1000) Beep (1500, 1000) Sleep (1000) Beep (1500, 1000) EndFunc When the words fail... music speaks. Link to comment Share on other sites More sharing options...
Glyph Posted November 11, 2008 Share Posted November 11, 2008 (edited) While 1 If @MIN = "00" Then MySound(5) MsgBox(0, "Time to turn outdoor sign?", "Is it time to turn on the outdoor sign?") MySound(5) EndIf Sleep(25) WEnd Func MySound($times) $i=0 do $i+=1 Beep (1500, 1000) sleep(1000) until $i = $times EndFunc Edited November 11, 2008 by Glyph tolle indicium Link to comment Share on other sites More sharing options...
CounterCraft Posted November 15, 2008 Author Share Posted November 15, 2008 (edited) While 1 If @MIN = "00" Then MySound(5) $canExit = InputBox ("Is it time to turn outdoor sign?", "Type YES to terminate the program, else press ok") if $canExit = "YES" then Exit EndIf Sleep(60000) EndIfWEndFunc MySound($times)while $times > 0 $times = $times - 1 Beep (1500, 1000) sleep (1000)WEndEndFuncLittle more organized, but how do script distinguish between OK and Cancel button? Edited November 15, 2008 by CounterCraft Link to comment Share on other sites More sharing options...
oMBRa Posted November 15, 2008 Share Posted November 15, 2008 (edited) #include <Date.au3> Global $sNewDate = _DateAdd('h', 1, _NowCalc()) While 1 If _NowCalc() = $sNewDate Then MySound(1) $ID = MsgBox(4, "Time to turn outdoor sign?", "Is it time to turn on the outdoor sign?") If $ID = 6 Then Exit EndIf EndIf Sleep(10) WEnd Func MySound($times) Local $i = 0 Do $i += 1 Beep(1500, 1000) Sleep(1000) Until $i = $times $sNewDate = _DateAdd('h', 1, _NowCalc()) EndFunc ;==>MySound Edited November 15, 2008 by oMBra 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