Jump to content

Alarm Clock


Tomb
 Share

Recommended Posts

I decided to make a alarm clock that could be minimized to tray.

it is most effective in the startup folder so the alarm can go off always at the time you have inputted, and it saves the information in Alarm.ini as you change the inputboxes.

just put the hour, minute (must be 2 digits(so if its like 12:07 you have to write 07 here, can't just be 7)), AM or PM, and the custom message you want to be in the message box.

minimizing the gui window sends it to tray, and clicking the tray icon gives you the option of restore or exit.

i have attached the script and the compiled .exe

and i will also put the code here.

#include <Date.au3>
#include <GuiConstants.au3>
#include <Constants.au3>

#NoTrayIcon

$gui = GuiCreate("Alarm", 250, 165, -1, -1)
GUISetBkColor(0x000000, $gui)
$font="Arial"
GUISetFont(9, 400, 0, $font)

$inihour = IniRead("alarm.ini", "hour", "key", "hour")
$iniminute = IniRead("alarm.ini", "minute", "key", "minute")
$iniAMPM = IniRead("alarm.ini", "AMPM", "key", "AMPM")
$inimessage = IniRead("alarm.ini", "message", "key", "message")

$hour = GuiCtrlCreateInput(($inihour), 20, 20, 50, 20)
$minute = GuiCtrlCreateInput(($iniminute), 100, 20, 50, 20)
$AMPM = GuiCtrlCreateInput(($iniAMPM), 180, 20, 50, 20)
$message = GuiCtrlCreateInput(($inimessage), 20, 75, 210, 20)
$timelabel = GuiCtrlCreatelabel("Current Time : " & _NowTime(), 20, 125, 200, 20)
GUICtrlSetColor(-1,0xff0000)
GuiSetState(@SW_SHOW)

Opt("TrayOnEventMode",1)
Opt("TrayMenuMode",1) 
Opt("GUIOnEventMode", 1)

GUISetOnEvent($GUI_EVENT_CLOSE, "ExitScript")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "_MinTray")

$restoreitem = TrayCreateItem("Restore")
TrayItemSetOnEvent(-1,"RestoreTray")
TrayCreateItem("")
$exititem = TrayCreateItem("Exit")
TrayItemSetOnEvent(-1,"ExitScript")
TraySetState(2)

While 1
If _NowTime() = GUICtrlRead($hour) & ":" & GUICtrlRead($minute) & ":00 " & GUICtrlRead($AMPM) Then
Beep(500, 500)
sleep(500)
Beep(500, 500)
sleep(500)
Beep(500, 500)
sleep(500)
Beep(500, 500)
sleep(500)
MsgBox(0, "Alarm", "It is " & _NowTime() & ". " & GUICtrlRead($message))
Else
sleep(1000)
GuiCtrlSetData($timelabel, "Current Time : " & _NowTime())
EndIf

If GUICtrlRead($hour) <> $inihour then
IniWrite("alarm.ini", "hour", "key", GUICtrlRead($hour))
EndIf

If GUICtrlRead($minute) <> $iniminute then
IniWrite("alarm.ini", "minute", "key", GUICtrlRead($minute))
EndIf

If GUICtrlRead($AMPM) <> $iniAMPM then
IniWrite("alarm.ini", "AMPM", "key", GUICtrlRead($AMPM))
EndIf

If GUICtrlRead($message) <> $inimessage then
IniWrite("alarm.ini", "message", "key", GUICtrlRead($message))
EndIf
WEnd

Func _MinTray()
GuiSetState(@SW_HIDE)
TraySetState(1)
EndFunc

Func RestoreTray()
GuiSetState(@SW_SHOW)
GuiSetState(@SW_RESTORE)
TraySetState(2)
EndFunc

Func ExitScript()
    Exit
EndFunc

Alarm.au3

Alarm.exe

Link to comment
Share on other sites

Quiet down children. Justin, stop cursing, it'll just make you look like a very immature child, which I know your not. Swift, don't argue back. If anyone should be cursing it's me, nobody like my alarm clock, and it was much better IMO. xD but good job anyways.

[center][/center]Working on the next big thing.Currently Playing: Halo 4, League of LegendsXBL GT: iRememberYhslaw

Link to comment
Share on other sites

this is good. a ton of people downloaded it. 19 of the au3 and 16 of the exe. i was only 1 of each to make sure i uploaded correctly. lol.

i hope people can make practical use of my Alarm Clock. :)

thanks for nice comments guys.

Link to comment
Share on other sites

  • 4 weeks later...

Looks great.

Maybe add a checkbox for the beeps :D There may be some people out there who don't like noise..

And, and, and maybe lose the am/pm :)

I personally don't like the am/pm system and above all there are not many countries out there who use the am/pm system.

24h FTW!! :D

My active project(s): A-maze-ing generator (generates a maze)

My archived project(s): Pong3 (Multi-pinger)

Link to comment
Share on other sites

  • 12 years later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...