;AlarmClock.ahk ; Enter a time and a message to set an alarm ;Skrommel @ 2017 #NoEnv #Persistent #SingleInstance,Force applicationname=AlarmClock MENU: Menu,Tray,NoStandard Menu,Tray,Add,%applicationname%,SHOW Menu,Tray,Add,&About...,ABOUT Menu,Tray,Add,&Exit,EXIT Menu,Tray,Default,%applicationname% Menu,Tray,Click,1 Menu,Tray,Tip,%applicationname% AMPM: use24=0 RegRead,timeformat,HKEY_USERS,.DEFAULT\Control Panel\International,sTimeFormat IfInString,timeformat,HH use24=1 If (use24=0) { Loop,12 hours:=hours SubStr("0" A_Index,-1,2) " am|" Loop,12 hours:=hours SubStr("0" A_Index,-1,2) " pm|" } Else { Loop,24 hours:=hours SubStr("0" A_Index-1,-1,2) "|" } Loop,60 minutes:=minutes SubStr("0" A_Index-1,-1,2) "|" GUI: Gui,Add,ComboBox,XM W60 Vhour,% hours Gui,Add,ComboBox,X+5 W40 Vminute,% minutes Gui,Add,Edit,X+5 W100 Vmessage,Alarm! Gui,Add,Button,X+5 GSTART,&Start Gui,Show,,%applicationname% Return SHOW: Gui,SHOW Return START: Gui,Submit If hour= { hour:=A_Hour+1 If (hour>23) hour:="00" } If minute= minute:="00" IfInString,hour,am hour:=SubStr(hour,1,2) IfInString,hour,pm { hour:=SubStr(hour,1,2)+12 If (hour=24) hour:="00" } now:=A_Now alarm:=A_Year A_Mon A_DD SubStr("0" hour,-1,2) SubStr("0" minute,-1,2) "00" If (now>alarm) EnvAdd,alarm,1,Day timer:=alarm EnvSub,timer,now,Seconds timer:=timer*-1000 SetTimer,ALARM,% timer If (use24=0) FormatTime,alarm,% alarm, dddd MMMM d, yyyy hh:mm tt Else FormatTime,alarm,% alarm, dddd d. MMMM yyyy hh:mm TrayTip,%applicationname%,% message " set for " alarm,3 Menu,Tray,Tip,% message " set for " alarm Return ALARM: MsgBox,64,%applicationname%,% message Return ABOUT: Gui,99:Destroy Gui,99:Margin,20,20 Gui,99:Add,Picture,xm Icon1,%applicationname%.exe Gui,99:Font,Bold Gui,99:Add,Text,x+10 yp+10,%applicationname% v1.1 Gui,99:Font Gui,99:Add,Text,y+10,Enter a time and a message to set an alarm Gui,99:Add,Text,y+10,- Supports both am/pm and 24 hour clock Gui,99:Add,Text,y+10,- No need to input minutes Gui,99:Add,Picture,xm y+20 Icon2,%applicationname%.exe Gui,99:Font,Bold Gui,99:Add,Text,x+10 yp+10,1 Hour Software by Skrommel Gui,99:Font Gui,99:Add,Text,y+10,For more tools, information and donations, please visit Gui,99:Font,CBlue Underline Gui,99:Add,Text,y+5 G1HOURSOFTWARE,www.1HourSoftware.no Gui,99:Font Gui,99:Add,Picture,xm y+20 Icon3,%applicationname%.exe Gui,99:Font,Bold Gui,99:Add,Text,x+10 yp+10,DonationCoder Gui,99:Font Gui,99:Add,Text,y+10,Please support the contributors at Gui,99:Font,CBlue Underline Gui,99:Add,Text,y+5 GDONATIONCODER,www.DonationCoder.com Gui,99:Font Gui,99:Add,Picture,xm y+20 Icon4,%applicationname%.exe Gui,99:Font,Bold Gui,99:Add,Text,x+10 yp+10,AutoHotkey Gui,99:Font Gui,99:Add,Text,y+10,This tool was made using the powerful Gui,99:Font,CBlue Underline Gui,99:Add,Text,y+5 GAUTOHOTKEY,www.AutoHotkey.com Gui,99:Font Gui,99:Show,,%applicationname% About hCur:=DllCall("LoadCursor","UInt",NULL,"Int",32649,"UInt") ;IDC_HAND OnMessage(0x200,"WM_MOUSEMOVE") Return 1HOURSOFTWARE: Run,http://www.1hoursoftware.no,,UseErrorLevel Return DONATIONCODER: Run,http://www.donationcoder.com,,UseErrorLevel Return AUTOHOTKEY: Run,http://www.autohotkey.com,,UseErrorLevel Return 99GuiClose: Gui,99:Destroy OnMessage(0x200,"") DllCall("DestroyCursor","Uint",hCur) Return WM_MOUSEMOVE(wParam,lParam) { Global hCur MouseGetPos,,,,ctrl If ctrl in Static9,Static13,Static17 DllCall("SetCursor","UInt",hCur) Return } Return EXIT: ExitApp