Sign in to follow this  
Followers 0
Private

Alarm with date and time

Build by beginner with autoit   5 members have voted

  1. 1. How would you grade my alarm in AutoIt

    • 1 - Very Bad
      1
    • 2 - Bad
      2
    • 3 - Normal
      2
    • 4 - Good
      0
    • 5 - Very Good
      0

Please sign in or register to vote in this poll.

4 posts in this topic

Hello all :"> ,

Kinda shy, cause this is my first post in this forum :P

I have checked out AutoIt and when i was drunk with a friend of mine, he had an idea :) and so dared me to create an Alarm in AutoIt...

this is what i created, (all in dutch but it's all about the functionality wright :D )

#cs ----------------------------------------------------------------------------
    
    AutoIt Version: 3.1.1.0
    Author:         Daryl Peeters
    
    Script Function:
    Wekker voor Frankie
    
#ce ----------------------------------------------------------------------------

#region     ---   Configureren GUI   ---
; Constanten aanroepen
#include <GuiConstants.au3>
#include <Date.au3>
#NoTrayIcon

HotKeySet ("+^{F12}","_StopAlarm")

#region     ---   Instellingen GUI   ---
; Aanmaken van de GUI
GuiCreate                                       ("Wekker voor Frankie",     493, 234,  -1,  -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)   )

; Datumvelden
$LA_DatumVanAf          = GuiCtrlCreateLabel    ("Datum vanaf",              30,  20, 200,  20                                                  )
$DA_DatumVanAf          = GuiCtrlCreateDate     ("Datum vanaf",              30,  40, 200,  20                                                  )
$LA_DatumTotEnMet       = GuiCtrlCreateLabel    ("Datum tot en met",        270,  20, 200,  20                                                  )
$DA_DatumTotEnMet       = GuiCtrlCreateDate     ("Datum vanaf",             270,  40, 200,  20                                                  )

; Tijdvelden
$LA_TijdVanAf           = GuiCtrlCreateLabel    ("Tijd vanaf",               30,  70, 200,  20                                                  )
$LA_ScheidingTijdVanAf  = GuiCtrlCreateLabel    (" : ",                      75,  95,  40,  20                                                  )
$CO_UurTijdVanAf        = GUICtrlCreateCombo    ("00",                       30,  90,  40,  20                                                  )
$CO_MinTijdVanAf        = GuiCtrlCreateCombo    ("00",                       90,  90,  40,  20                                                  )

$LA_TijdTotEnMet        = GuiCtrlCreateLabel    ("Tijd tot en met",         270,  70, 200,  20                                                  )
$LA_Scheiding           = GuiCtrlCreateLabel    (" : ",                     315,  95,  40,  20                                                  )
$CO_UurTijdTotEnMet     = GUICtrlCreateCombo    ("00",                      270,  90,  40,  20                                                  )
$CO_MinTijdTotEnMet     = GuiCtrlCreateCombo    ("00",                      330,  90,  40,  20                                                  )

; Knop om de werkker te starten
$BTN_StartWekker        = GuiCtrlCreateButton   ("Start wekker",            270, 130, 200,  20                                                  )
$BTN_StopWekker         = GuiCtrlCreateButton   ("Stop wekker",             270, 150, 200,  20                                                  )

; Group voor een lijn om de instellingen
$GR_Alles               = GuiCtrlCreateGroup    ("",                         20,  10, 460, 180                                                  )

; Inputbox (ReadOnly) voor de CountDown
$IN_CountDown           = GuiCtrlCreateInput    ("Countdown",                20, 200, 460,  20, $ES_READONLY                                    )
#endregion  ---   Instellingen GUI   ---





#region     ---   Tijden declareren  ---
; Minuten declareren
GuiCtrlSetData ($CO_MinTijdVanAf,   "00|05|10|15|20|25|30|35|40|45|50|55","00")
GuiCtrlSetData ($CO_MinTijdTotEnMet,"00|05|10|15|20|25|30|35|40|45|50|55","00")

; Uren declareren
GuiCtrlSetData ($CO_UurTijdVanaf,   "00|01|02|03|04|05|06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24","00")
GuiCtrlSetData ($CO_UurTijdTotEnMet,"00|01|02|03|04|05|06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24","00")
#endregion  ---   Tijden declareren  ---



#region     ---   Dagen declareren   ---
;~ msgbox (0,"", $Weekdag & " " & @MDAY & " " & $Maand & " " & @YEAR)

$Weekdag                = ""
If      @WDay           = 1 Then
    $Weekdag            = "zondag"
ElseIf  @WDAY           = 2 Then
    $Weekdag            = ",aandag"
ElseIf  @WDAY           = 3 Then
    $Weekdag            = "dinsdag"
ElseIf  @WDAY           = 4 Then
    $Weekdag            = "woensdag"
ElseIf  @WDAY           = 5 Then
    $Weekdag            = "donderdag"
ElseIf  @WDAY           = 6 Then
    $WeekDag            = "vrijdag"
ElseIf  @WDAY           = 7 Then
    $WeekDag            = "zaterdag"
EndIf
#endregion  ---   Dagen declareren   ---
#region     ---   Maand declareren   ---
;~ msgbox (0,"", $Weekdag & " " & @MDAY & " " & $Maand & " " & @YEAR)
$Maand                  = ""
If       @MON           = 1  Then
    $Maand              = "januari"
ElseIf   @MON           = 2  Then
    $Maand              = "februari"
ElseIf   @MON           = 3  Then
    $Maand              = "maart"
ElseIf   @MON           = 4  Then
    $Maand              = "april"
ElseIf   @MON           = 5  Then
    $Maand              = "mei"
ElseIf   @MON           = 6  Then
    $Maand              = "juni"
ElseIf   @MON           = 7  Then
    $Maand              = "juli"
ElseIf   @MON           = 8  Then
    $Maand              = "augustus"
ElseIf   @MON           = 9  Then
    $Maand              = "september"
ElseIf   @MON           = 10 Then
    $Maand              = "oktober"
ElseIf   @MON           = 11 Then
    $Maand              = "november"
ElseIf   @MON           = 12 Then
    $Maand              = "december"
EndIf
#endregion  ---   Maand declareren   ---

#region     ---   While in Gui       ---
; While voor de GUI
GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $BTN_StopWekker
            _StopAlarm()
        Case $msg = $BTN_StartWekker
            #region     ---   Tijden uitlezen    ---
            ; [Minuten : Uren] VANAF declareren
            $ACO_MinTijdVanAf       = GuiCtrlRead ($CO_MinTijdVanAf)
            $ACO_UurTijdVanAf       = GuiCtrlRead ($CO_UurTijdVanAf)
            $ACO_TijdVanAf          = $ACO_UurTijdVanAf & ":" & $ACO_MinTijdVanAf

            ; [Miniuten : Uren] TOTENMET declareren
            $ACO_MinTijdToTEnMet    = GuiCtrlRead ($CO_MinTijdTotEnMet)
            $ACO_UurTijdTotEnMet    = GuiCtrlRead ($CO_UurTijdTotEnMet)
            $ACO_TijdToTEnMet       = $ACO_UurTijdTotEnMet & ":" & $ACO_MinTijdTotEnMet
            #endregion  ---   Tijden uitlezen    ---
            #region     ---   Datums uitlezen    ---
            ; [Datum] VANAF declareren
            $ADA_DatumVanAf         = GuiCtrlRead ($DA_DatumVanAf)

            ; [Datum] TOTENMET declareren
            $ADA_DatumTotEnMet      = GuiCtrlRead ($DA_DatumTotEnMet)
            #endregion  ---   Datums uitlezen    ---

            While ($ADA_DatumVanAf  = ($Weekdag & " " & @MDAY & " " & $Maand & " " & @YEAR)) and ($ACO_TijdVanaf= @HOUR & ":" & @MIN)
                do
                    beep (1200,200)
                    sleep (100)
                    beep (1200,200)
                    sleep (100)
                    beep (1200,200)
                    sleep (100)
                    beep (1200,500)
                    sleep (100)
                    beep (1200,500)
                    sleep (100)
                    beep (1200,200)
                    sleep (100)
                    beep (1200,200)
                    sleep (100)
                    beep (1200,200)
                    sleep (1000)
                until (($Weekdag & " " & @MDAY & " " & $Maand & " " & @YEAR)        = $ADA_DatumTotEnMet) and (@HOUR & ":" & @MIN   = $ACO_TijdTotEnMet)
            WEnd
        Case Else
            ;;;
    EndSelect
WEnd

Func _StopAlarm()
    $MsgBox_Antwoord = 0
    $MsgBox_Antwoord = MsgBox(52,"Wekker veur Frankie","Zeg Frankie, de bis now toch neet al wakker ofwaal? ")
    Select
        Case $MsgBox_Antwoord = 6 ;Yes
            Exit
        Case $MsgBox_Antwoord = 7 ;No
            MsgBox(0,"Wekker veur Frankie","Det dacht ik al, gank maar lekker verder pitte, dan jengel ik nog wat door")
    EndSelect
EndFunc

#endregion  ---   While in Gui       ---
#endregion  ---   Configureren GUI   ---

you could better download the script and open it in SciTe because of my tabs (i like to read a script in a blink of an eye so i tab'd my script :D )

Please let me know what you think of my scripting, i would appreaciate if any comments would go in this post, as it can be negative and positive.

Best regards,

Daryl Peeters

Share this post


Link to post
Share on other sites



Could you put in in English plz

Tks


"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

It's good to see a new dutch coder on the forums. However, if you're going to share made scripts, I do suggest you rewrite/write them from scratch in english.

The script isn't bad, good luck! :)

Share this post


Link to post
Share on other sites

It doesn't seem to work for me. I set it but it doesn't do anything when the clock gets to the time set. :)

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