Sign in to follow this  
Followers 0
jvanegmond

TrayAlarm

18 posts in this topic

#1 ·  Posted (edited)

TrayAlarm

Description:

TrayAlarm is a a lightweight alarm clock application that minimizes to the tray. It's very simple to set up.

Posted Image

When the alarm goes off the following things happen:

  • A sound is played repeatedly to warn you, even when you are not at your PC.
  • A big window pops up to warm you the alarm is going off, even when your sound is off.
You have to click a button to stop the alarm.

In the new version, the main window minimizes to the tray.. in stead of sticking to your desktop.

2011 edit: Since this is quite old, but I still use it frequently. Some public service announcements:

- The original source has been lost. The icons used, the compiled executable: All gone.

- I reposted the original source in the original post. The source was also a few posts down.

- I have fixed the original source code posted to work with AutoIt v3.3.6.1

- Project name changed from Mini Alarm to TrayAlarm because it fits better.

#NoTrayIcon

#include <Constants.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>

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

TraySetOnEvent($TRAY_EVENT_PRIMARYUP, "Minimize")

Dim $AlarmON = 0, $FirstTime = 1

$GUI = GUICreate("Mini Alarm", 169, 63, @DesktopWidth * (2 / 3), 0)
GUISetFont(10, 400, 0, "Verdana")
$Label1 = GUICtrlCreateLabel("Alarm Time:", 5, 8, 82, 20)
$Input1 = GUICtrlCreateInput(@HOUR & ":" & @MIN, 90, 5, 76, 24, BitOR($ES_CENTER, $ES_AUTOHSCROLL))
$Button1 = GUICtrlCreateButton("Set Alarm Time", 5, 35, 160, 25)
GUISetState(@SW_SHOW, $GUI)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $GUI_EVENT_MINIMIZE
            GUISetState(@SW_HIDE, $GUI)
            TraySetState(1)
            If $FirstTime Then
                TrayTip("Mini Alarm", "Mini Alarm is minimized to the tray. Click on the tray icon here to restore the window.", 10)
                $FirstTime = 0
            EndIf
        Case $Button1
            If Not $AlarmON Then
                GUICtrlSetState($Input1, $GUI_DISABLE)
                GUICtrlSetData($Button1, "Cancel Alarm")
                $AlarmON = 1
            Else
                GUICtrlSetState($Input1, $GUI_ENABLE)
                GUICtrlSetData($Button1, "Set Alarm Time")
                $AlarmON = 0
            EndIf
    EndSwitch
    If $AlarmON And (GUICtrlRead($Input1) = @HOUR & ":" & @MIN) Then
        GUICtrlSetState($Button1, $GUI_DISABLE)
        Alarm()
        GUICtrlSetState($Input1, $GUI_ENABLE)
        GUICtrlSetState($Button1, $GUI_ENABLE)
        GUICtrlSetData($Button1, "Set Alarm Time")
        $AlarmON = 0
        Minimize()
    EndIf
WEnd

Func Alarm()
    $GUIAlarm = GUICreate("Alarm!!", 294, 77, -1, -1, BitXOR($GUI_SS_DEFAULT_GUI,$WS_MINIMIZEBOX))
    $Button2 = GUICtrlCreateButton("Stop Alarm", 5, 40, 285, 30, 0)
    GUICtrlSetFont(-1, 10, 400, 0, "Verdana")
    GUICtrlCreateLabel("ALARM!! ALARM!! ALARM!!", 5, 5, 285, 29)
    GUICtrlSetFont(-1, 16, 400, 0, "Verdana")
    GUISetState(@SW_SHOW, $GUIAlarm)

    WinSetOnTop($GUIAlarm, "", 1)

    $Beep = 0
    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE, $Button2
                ExitLoop
        EndSwitch
        If TimerDiff($Beep) > 1300 Then
            SoundPlay(@WindowsDir & "\media\ringout.wav", 0)
            $Beep = TimerInit()
        EndIf
    WEnd

    GUIDelete($GUIAlarm)
EndFunc   ;==>Alarm

Func Minimize()
    TraySetState(2)
    GUISetState(@SW_SHOW, $GUI)
    GUISetState(@SW_RESTORE, $GUI)
EndFunc   ;==>Minimize
Edited by Manadar

Share this post


Link to post
Share on other sites



Nice, thanks for sharing.

Btw, where do you get the skin ?


[u]My Projects[/u]:General:WinShell (Version 1.6)YouTube Video Downloader Core (Version 2.0)Periodic Table Of Chemical Elements (Version 1.0)Web-Based:Directory Listing Script Written In AutoIt3 (Version 1.9 RC1)UDFs:UnicodeURL UDFHTML Entity UDF[u]My Website:[/u]http://dhilip89.hopto.org/[u]Closed Sources:[/u]YouTube Video Downloader (Version 1.3)[quote]If 1 + 1 = 10, then 1 + 1 ≠ 2[/quote]

Share this post


Link to post
Share on other sites

Nice, simple and easy to use. I might suggest adding minimize to tray as an option.or a set of hot keys to hide it and bringit back when called.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Nice, thanks for sharing.

Btw, where do you get the skin ?

I have WindowBlinds 5.5 Acrylic skin.

Edited by Manadar

Share this post


Link to post
Share on other sites

Nice, simple and easy to use. I might suggest adding minimize to tray as an option.or a set of hot keys to hide it and bringit back when called.

I'll do a minimize to tray feature.

Click on the minus, and it goes to the tray, click on the tray and it is back. Thanks for the suggestion.

Share this post


Link to post
Share on other sites

Nice, simple and easy to use. I might suggest adding minimize to tray as an option.or a set of hot keys to hide it and bringit back when called.

Done. <_<

Thanks to JamesB for the example.

Share this post


Link to post
Share on other sites

I downloaded WindowBlinds 5.5 for free and got the Acrylic skin.

I don't use WB because my PC has only 128MB of RAM.


[u]My Projects[/u]:General:WinShell (Version 1.6)YouTube Video Downloader Core (Version 2.0)Periodic Table Of Chemical Elements (Version 1.0)Web-Based:Directory Listing Script Written In AutoIt3 (Version 1.9 RC1)UDFs:UnicodeURL UDFHTML Entity UDF[u]My Website:[/u]http://dhilip89.hopto.org/[u]Closed Sources:[/u]YouTube Video Downloader (Version 1.3)[quote]If 1 + 1 = 10, then 1 + 1 ≠ 2[/quote]

Share this post


Link to post
Share on other sites

Nice and Siple.

Its very usefull for me Ty ^^

Keep going <_<


Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites

Nice and Siple.

Its very usefull for me Ty ^^

Keep going <_<

Thanks for the compliments.

I mainly made it because I needed this for a game where you have to push a button at random times. Like 15:21, so I would just set up the alarm and done! :)

Share this post


Link to post
Share on other sites

Thanks for the compliments.

I mainly made it because I needed this for a game where you have to push a button at random times. Like 15:21, so I would just set up the alarm and done! <_<

The link seems to be broken to download this. Can someone post it again?

Or can Manadar or someone post the source in a message?

Thanks

Share this post


Link to post
Share on other sites

The link seems to be broken to download this. Can someone post it again?

Or can Manadar or someone post the source in a message?

Thanks

I just tried the link and it worked. It has worked for others. Maybe it was down, but now it is up again.

Anyway, I'll post the source here, although it becomes cooler when you use the icon. <_<

#NoTrayIcon
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=icon.ico
#AutoIt3Wrapper_outfile=MiniAlarm.exe
#AutoIt3Wrapper_Res_Comment=Made by Manadar on 19 oktober 2007
#AutoIt3Wrapper_Res_Description=This is a mini alarm made for the AutoIt community.
#AutoIt3Wrapper_Res_LegalCopyright=Free to copy, including source.
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#Region AutoIt3Wrapper directives section
#EndRegion


#include <Constants.au3>
#include <GUIConstants.au3>

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

TraySetOnEvent($TRAY_EVENT_PRIMARYUP, "Minimize")

Dim $AlarmON = 0, $FirstTime = 1

$GUI = GUICreate("Mini Alarm", 169, 63, @DesktopWidth * (2 / 3), 0)
GUISetFont(10, 400, 0, "Verdana")
$Label1 = GUICtrlCreateLabel("Alarm Time:", 5, 8, 82, 20)
$Input1 = GUICtrlCreateInput(@HOUR & ":" & @MIN, 90, 5, 76, 24, BitOR($ES_CENTER, $ES_AUTOHSCROLL))
$Button1 = GUICtrlCreateButton("Set Alarm Time", 5, 35, 160, 25)
GUISetState(@SW_SHOW, $GUI)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $GUI_EVENT_MINIMIZE
            GUISetState(@SW_HIDE, $GUI)
            TraySetState(1)
            If $FirstTime Then
                TrayTip("Mini Alarm", "Mini Alarm is minimized to the tray. Click on the tray icon here to restore the window.", 10)
                $FirstTime = 0
            EndIf
        Case $Button1
            If Not $AlarmON Then
                GUICtrlSetState($Input1, $GUI_DISABLE)
                GUICtrlSetData($Button1, "Cancel Alarm")
                $AlarmON = 1
            Else
                GUICtrlSetState($Input1, $GUI_ENABLE)
                GUICtrlSetData($Button1, "Set Alarm Time")
                $AlarmON = 0
            EndIf
    EndSwitch
    If $AlarmON And (GUICtrlRead($Input1) = @HOUR & ":" & @MIN) Then
        GUICtrlSetState($Button1, $GUI_DISABLE)
        Alarm()
        GUICtrlSetState($Input1, $GUI_ENABLE)
        GUICtrlSetState($Button1, $GUI_ENABLE)
        GUICtrlSetData($Button1, "Set Alarm Time")
        $AlarmON = 0
        Minimize()
    EndIf
WEnd

Func Alarm()
    $GUIAlarm = GUICreate("Alarm!!", 294, 77, -1, -1, BitXOR($GUI_SS_DEFAULT_GUI,$WS_MINIMIZEBOX))
    $Button2 = GUICtrlCreateButton("Stop Alarm", 5, 40, 285, 30, 0)
    GUICtrlSetFont(-1, 10, 400, 0, "Verdana")
    GUICtrlCreateLabel("ALARM!! ALARM!! ALARM!!", 5, 5, 285, 29)
    GUICtrlSetFont(-1, 16, 400, 0, "Verdana")
    GUISetState(@SW_SHOW, $GUIAlarm)
    
    WinSetOnTop($GUIAlarm, "", 1)
    
    $Beep = 0
    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE, $Button2
                ExitLoop
        EndSwitch
        If TimerDiff($Beep) > 1300 Then
            SoundPlay(@WindowsDir & "\media\ringout.wav", 0)
            $Beep = TimerInit()
        EndIf
    WEnd
    
    GUIDelete($GUIAlarm)
EndFunc   ;==>Alarm

Func Minimize()
    TraySetState(2)
    GUISetState(@SW_SHOW, $GUI)
    GUISetState(@SW_RESTORE, $GUI)
EndFunc   ;==>Minimize

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

hi Manadar,

nice script there. good job!

however, i have modified your codes a little so that the Alarm has the "purpose" fucntion.

you may be using it for your games, but i believe for most of us we need the alarm to remind us why the alarm was set in the first place. i m a little busy at work and the "purpose" function will definitely be a big help.

edit : big help....not bug help.

Edited by iceberg

mouse not found....scroll any mouse to continue.

Share this post


Link to post
Share on other sites

hi Manadar,

nice script there. good job!

however, i have modified your codes a little so that the Alarm has the "purpose" fucntion.

you may be using it for your games, but i believe for most of us we need the alarm to remind us why the alarm was set in the first place. i m a little busy at work and the "purpose" function will definitely be a big help.

edit : big help....not bug help.

<_< Nice little feature.

Share this post


Link to post
Share on other sites

Umm, a couple possible features.

Different beeps.

The option to choose if we want msg box to pop up or not. (Sound is enough for me)

A date, so if I want the alarm for tomorrow, it will save that in a .ini or whatever, and add itself to startup programs and the alarm will be ready.

Purpose... Unless you have that many alarms, or your memory is bad, I don't think it will be that handy.


"Its not about the 30 inch 1080p display, or the SLI 8800 ultras, or the DDR3 memory. It's about when you turn on your PC, does it return the favor?"Math is like sex. Sure, it may give some practical results, but that is not why we do it

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0