Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Alarmclock


  • Please log in to reply
No replies to this topic
Kevin4875
  • Members
  • 5 posts
  • Last active: May 03 2007 07:41 AM
  • Joined: 21 Mar 2006
Hi, this is my first script. :lol:
It's an alarm clock.
I hope u like it.

Here are the files u need to let it work.
It are 2 files.

First file:
alarmclock.ahk
#SingleInstance force
IniRead, alarm, alarm.ini, alarm, time,
Gui, Add, Button, x54 y110 w60 h20, Set time
Gui, Add, Button, x54 y130 w60 h20, Set sound
Gui, Add, Button, x54 y150 w60 h20, Set text
Gui, Add, Button, x34 y71 w100 h30, Turn on!
Gui, Font, S12 CDefault Bold, Verdana
Gui, Font, S8 CDefault, Verdana
Gui, Font, , 
Gui, Font, , 
Gui, Font, S12 CBlack Bold, Verdana
Gui, Font, S12 Bold, Verdana
Gui, Add, Text, x20 y29 w127 h18, Alarm @ %alarm%
Gui, Show, x421 y282 h196 w170, Alarmclock
Return

ButtonSettime:
InputBox, alarmset, Set time, Set time,
if ErrorLevel <> 0
Return
else
{
IniWrite, %alarmset%, alarm.ini, alarm, time
Run, alarmclock.ahk
Return
}

ButtonSetsound:
InputBox, sound, Set sound, This sound will be played when time is reached,
if ErrorLevel <> 0
Return
else
{
IniWrite, %sound%, alarm.ini, alarm, sound
Run, alarmclock.ahk
Return
}

ButtonSettext:
InputBox, text, Set text, This text will be displayed when time is reached,
if ErrorLevel <> 0
Return
else
{
IniWrite, %text%, alarm.ini, alarm, text
Run, alarmclock.ahk
Return
}

ButtonTurnon!:
Run, activate.ahk
ExitApp,

GuiClose:
ExitApp

Second file:
activate.ahk
#SingleInstance force
IniRead, alarm, alarm.ini, alarm, time,
IniRead, sound, alarm.ini, alarm, sound,
IniRead, text, alarm.ini, alarm, text,
Gui, Add, Button, x35 y71 w100 h30, Alarm activated
Gui, Font,  S12 CDefault Bold, Verdana
Gui, Font,  S8 CDefault, Verdana
Gui, Font, , 
Gui, Font, , 
Gui, Font,  S12 CBlack Bold, Verdana
Gui, Font,  S12 Bold, Verdana
Gui, Add, Text, x20 y29 w127 h18, Alarm @ %alarm%
Gui, Font, S8 CDefault, Verdana
Gui, Font, , 
Gui, Add, Button, x35 y110 w100 h30, Change settings
Gui, Show, x421 y282 h196 w170, Alarmclock
checktime:
WinGetText, time, ahk_class Shell_TrayWnd
IfInString, time, %alarm%
{
MsgBox, %text%
SoundPlay, %sound%
Run, alarmclock.ahk
ExitApp,
}
else
{
Sleep, 60000
Goto, checktime
}

ButtonChangesettings:
Run, alarmclock.ahk
ExitApp,

GuiClose:
MsgBox, 4,,Alarmclock is disabled if you close the program.`nContinue?
IfMsgBox, Yes
{
ExitApp
}
else
{
Reload
}

Run the alarmclock.ahk file, and ur ready!
U can choose the text that is displayed when the time is reached, and u can also choose a sound. If u don't want a sound, then leave the field blank. If u want a sound, then fill in the path to the sound and the sound wil be played when the time is reached.

SCRIPT TESTED ON WINDOWS XP. MAYBE THE SCRIPT DOESN'T SUPPORT OTHER OPERATING SYSTEMS, BECAUSE THE SCRIPT TAKES THE TIME FROM THE CLOCK IN THE TRAYBAR.

Greetingz. :-)