Lukepro2315 Posted May 16, 2015 Share Posted May 16, 2015 (edited) Hi guys, im building a program and i want to have as part of that program some "alarm clock".So what i want to do is selecting values A (as hours - $hourcount) and B (as minutes - $minutecount) and then activate those clock by confirming activation mark.So if time values will be same as values in windows time, and alarm clock mark will be ON, then msg "works" appears (then it will be replaced with sound ofc)So i wanted something like this:If $alarmclockmark = 1 and @HOUR = $hourcount and @MIN = $minutecount ThenMsgBox(0, "Works", "Works")EndIfBut it not works...any ideas?Ps.: Try it explain very simple...im stupid. Edited May 16, 2015 by Lukepro2315 Link to comment Share on other sites More sharing options...
water Posted May 16, 2015 Share Posted May 16, 2015 I just searched the forum and got a lot of hits for "alarm clock". So I'm sure you'll find what you need when searching for it My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Exit Posted May 16, 2015 Share Posted May 16, 2015 works for me:; prepare environment $alarmclockmark = 1 $hourcount = @HOUR $minutecount = @MIN ; run your code If $alarmclockmark = 1 And @HOUR = $hourcount And @MIN = $minutecount Then MsgBox(0, "Works", "Works") EndIf App: Au3toCmd UDF: _SingleScript() Link to comment Share on other sites More sharing options...
Lukepro2315 Posted May 16, 2015 Author Share Posted May 16, 2015 No, it dont work. Ill attach my script here, and i need this - when u click on "Alarm off", it should change to "alarm on" and it should show time that is set...and after reaching set time, it should show msgbox with "work".But instead it shows only numbers 6 and 8 and nothing else happens.Any ideas? Preview.au3 Link to comment Share on other sites More sharing options...
water Posted May 16, 2015 Share Posted May 16, 2015 Your usage of AdlibRegister in functionTimeshowfrequency is wrong. AdlibRegister should only be called once in a script. Check the help file for AdlibRegister. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
bernd670 Posted May 16, 2015 Share Posted May 16, 2015 Hello,try thisexpandcollapse popupGlobal $Alarm Global $Alarmset Global $Alarmhour Global $Alarmset Global $Quit Global $time Global $GUI_CHECKED Local $sFont = "Consolas" GUICreate("Alarm clock", 800, 600) GUISetState(@SW_SHOW) ;-------------------Exit------------------- $Quit = GUICtrlCreateButton("Exit", 740, 0, 60, 20) ;-------------------Time-------------------- GUICtrlCreateLabel("Actual time:", 500, 5, 80, 15) GUISetFont(9, 400, 0, $sFont) GUISetFont(15) $time = GUICtrlCreateLabel("", 600, 0, 100, 30) Timeshowfrequency() Func Timeshowfrequency() AdlibRegister("_SetTime", 1000) EndFunc ;==>Timeshowfrequency ;-------------------Alarm-------------------- GUISetFont(8.5, 400, 0) $Alarmhour = GUICtrlCreateInput("0", 120, 30, 40, 20) GUICtrlCreateUpdown(-1) GUICtrlSetLimit(-1, 23) GUICtrlSetState(1, $GUI_CHECKED) $Alarmminutes = GUICtrlCreateInput("0", 200, 30, 40, 20) GUICtrlCreateUpdown(-1) GUICtrlSetLimit(-1, 60) $Alarm = GUICtrlCreateCheckbox("Alarm off", 10, 30, 110, 20) GUICtrlSetState(1, $GUI_CHECKED) GUICtrlSetBkColor($Alarm, 0xCCCCCC) GUICtrlCreateLabel("hours", 170, 34, 30, 20) GUICtrlCreateLabel("minutes", 250, 34, 40, 20) While 1 Switch GUIGetMsg() Case $Alarm If $Alarmset = 0 Then $Alarmset = 1 GUICtrlSetBkColor($Alarm, 0x00FF00) GUICtrlSetData($Alarm, "Alarm set on " & int(GUICtrlRead($Alarmhour)) & ":" & int(GUICtrlRead($Alarmminutes)) & "") Else $Alarmset = 0 GUICtrlSetBkColor($Alarm, 0xCCCCCC) GUICtrlSetData($Alarm, "Alarm off") EndIf Case $Quit Exit EndSwitch If $Alarmset = 1 And @HOUR = int(GUICtrlRead($Alarmhour)) And @MIN = int(GUICtrlRead($Alarmminutes)) Then MsgBox(0, "Works", "Works") EndIf WEnd Func _SetTime() GUICtrlSetData($time, "" & @HOUR & ":" & @MIN & ":" & @SEC & "") EndFuncUse GuiCtrlRead to get the value from InputControl and the if-statement for alarm control must defined outside form switch statement. greetingsbernd I hacked 127.0.0.1 -> Link to comment Share on other sites More sharing options...
Lukepro2315 Posted May 16, 2015 Author Share Posted May 16, 2015 Your usage of AdlibRegister in functionTimeshowfrequency is wrong. AdlibRegister should only be called once in a script. Check the help file for AdlibRegister.This is only part of script i used there While 1 so i needed to put that time on Adlib register...but there is not problem - clock works fine, problem is in that alarm. Link to comment Share on other sites More sharing options...
Lukepro2315 Posted May 16, 2015 Author Share Posted May 16, 2015 Awesome. Thsts exactly what i needed. Thx Bernd 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