Sign in to follow this  
Followers 0
Kreatorul

Boostor Reminder *Beta*

3 posts in this topic

I've been working on this for the past few days. I forget birthdays and stuff I have to do most of the time so I made this...it has some cool features like custom alarm, select your own mp3 or use the "premade" ones, add/edit/remove reminder and it's very easy to use. The menu isn't finished but I will finish it tomorow and add minimize to tray and start at startup(minimized).

Here is the code but if you want the custom alarms download the zip file it has all the files including the source in there.

#include <GUIConstants.au3>
#include <File.au3>
#include <GuiList.au3>
#include <Sound.au3>

;;;;;;;;;;;;
Global $read
Global $flicker
Global $flicker1
Global $flicker2
Global $remlist
Global $exists = 0
Global $var = 0
Global $f = 1
Global $ss
Global $var2 = 1
Global $d = ""
Global $cuc = 0
;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;
DirCreate(@scriptdir & "\Reminders")
;;;;;;;;;;;;;;;;;;;;

;===========Add GUI==============;
#Region ### START Koda GUI section ### Form=C:\GAMES\AutoIt\Neterminate\Boostor Reminder\add reminder form.kxf
$gui2 = GUICreate("Reminder Add/Edit", 222, 414, -1, -1, $WS_POPUPWINDOW)
$Date1 = GUICtrlCreateDate("Date Picker", 15, 90, 191, 20)
$Label1 = GUICtrlCreateLabel("Pick a date for the reminder:", 15, 70, 147, 17)
$Label2 = GUICtrlCreateLabel("Name for the reminder:", 15, 15, 121, 17)
$Rname = GUICtrlCreateInput("My Reminder", 15, 35, 191, 20)
GuiCtrlSetLimit(-1, 24)
$labelmult = GuiCtrlCreateLabel("Write an hour for the reminder(hh:mm:ss):", 15, 125)
$hour = GuiCtrlCreateInput("12:00:00", 15, 145, 191, 20)
GuiCtrlSetLimit(-1, 8)
$Label3 = GUICtrlCreateLabel("Type of the reminder:", 15, 180, 119, 17)
$Birthday = GUICtrlCreateCombo("Birthday", 15, 200, 191, 25)
GuiCtrlSetData($Birthday, "School|Work|Party|Bar Mitzvah :))|Other")
$labelmult = GuiCtrlCreateLabel("The name of the celebrated person:", 15, 235)
$celeb=GuiCtrlCreateInput("", 15, 255, 191, 20)
GuiCtrlSetLimit(-1, 36)
$Label4 = GUICtrlCreateLabel("Notes:", 15, 285, 40, 17)
$Notes = GUICtrlCreateInput("My Notes", 15, 305, 191, 20)
GuiCtrlSetLimit(-1, 55)
$check = GuiCtrlCreateCheckbox("Use alarm sound?", 15, 335)
$rAdd = GUICtrlCreateButton("Add Reminder", 90, 370, 76, 26, 0)
$exit = GUICtrlCreateButton("Close",50, 370, 40, 26, 0)
#EndRegion ### END Koda GUI section ###
;=============End Add GUI================;

#Region ### START Koda GUI section ### Form=C:\GAMES\AutoIt\Neterminate\gui.kxf
$gui = GUICreate("Boostor Reminder", 521, 255, -1, -1)
$data = GUICtrlCreateDate("", 15, 600, 300, 20)
GuiCtrlSetState(-1, $GUI_HIDE)
$Reminders = GUICtrlCreateLabel("Reminders Manager:", 15, 15, 148, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$List1 = GUICtrlCreateList("", 15, 70, 131, 149)
GUICtrlSetData(-1, "")
$Date = GUICtrlCreateDate("Date Picker", 15, 40, 186, 21)
$Add = GUICtrlCreateButton("Add", 155, 70, 46, 41, 0)
$Remove = GUICtrlCreateButton("Remove", 155, 180, 46, 41, 0)
$Edit = GUICtrlCreateButton("Edit", 155, 125, 46, 41, 0)
$Name = GUICtrlCreateLabel("Name, Date and Time:", 220, 70, 150, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Type = GUICtrlCreateLabel("Type:", 220, 125, 39, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label1 = GUICtrlCreateLabel("Notes:", 220, 180, 43, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$File = GUICtrlCreateMenu("&File")
$Settings = GUICtrlCreateMenu("&Settings")
$Help = GUICtrlCreateMenu("&Help")
$ndt = GuiCtrlCreateLabel("", 220, 89, 300, 32)
$t = GuiCtrlCreateLabel("", 220, 145, 300, 32)
$n = GuiCtrlCreateLabel("", 220, 199, 300, 50)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    Sleep(20)
    $Msg = GUIGetMsg()
    
    If $Msg=$GUI_EVENT_CLOSE Then Exit
    
    If $Msg=$Add Then
    GuiCtrlSetData($Rname, "My Reminder")
    GuiCtrlSetData($hour, "12:00")
    GuiCtrlSetData($celeb, "")
    GuiCtrlSetData($notes, "My Notes")
    GuiCtrlSetData($date1, GuiCtrlRead($data))
        GuiSetState(@SW_ENABLE, $gui2)
        GuiSetState(@SW_SHOW, $gui2)
        EndIf
        
If $Msg = $exit Then
        GuiSetState(@SW_HIDE, $gui2)
        GuiSetState(@SW_ENABLE, $gui)
        GuiCtrlSetData($radd, "Add")
    EndIf
    
    $search=_FileListToArray(@scriptdir & "\Reminders\" & GuiCtrlRead($data))
    If IsArray($search) Then
    For $f = 1 to $search[0]
        $r = FileReadLine(@scriptdir & "\Reminders\" & GuiCtrlRead($data) & "\" & $search[$f], 1)
        If $r = GuiCtrlRead($data) Then
            If FileReadLine(@scriptdir & "\Reminders\" & GuiCtrlRead($data) & "\" & $search[$f], 2) = @hour & ":" & @min & ":" & @sec Then 
        
        
#Region ### START Koda GUI section ### Form=
$gui4 = GUICreate("REMINDER!!!", 350, 197, 193, 125)
$Label1 = GUICtrlCreateLabel("REMINDER!!!", 113, 15, 129, 28)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
$Label2 = GUICtrlCreateLabel("Name: " & StringTrimRight($search[$f], 4), 10, 60, 330, 20)

$Label3 = GUICtrlCreateLabel("Date: " & GuiCtrlRead($data) & " | " & FileReadLine(@scriptdir & "\Reminders\" & GuiCtrlRead($data) & "\" & $search[$f], 2), 10, 87, 330, 15)

$Label4 = GUICtrlCreateLabel("Type: " & FileReadLine(@scriptdir & "\Reminders\" & GuiCtrlRead($data) & "\" & $search[$f], 3), 10, 113, 330, 16)

$Label5 = GUICtrlCreateLabel("Notes: " & FileReadLine(@scriptdir & "\Reminders\" & GuiCtrlRead($data) & "\" & $search[$f], 4), 11, 139, 330, 20)

$stopalarm = GUICtrlCreateButton("Stop Alarm", 98, 165, 65, 25, 0)
$delreminder = GUICtrlCreateButton("Delete Reminder", 166, 165, 90, 25, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    
    If FileReadLine(@scriptdir & "\Reminders\" & GuiCtrlRead($data) & "\" & $search[$f], 5) <> "" Then 
        $sound=_SoundOpen(FileReadLine(@scriptdir & "\Reminders\" & GuiCtrlRead($data) & "\" & $search[$f], 5), "Sound")
        If $cuc = 0 Then
        _SoundPlay($sound)
        $cuc=1
    EndIf
    EndIf
    
    If $nMsg = $stopalarm Then
        _SoundStop($sound)
        $cuc = 0
        GuiDelete($gui4)
        GUiSetState()
        ExitLoop
    EndIf
    
    If $nMsg = $delreminder Then
        _SoundStop($sound)
        FileDelete(@scriptdir & "\Reminders\" & GuiCtrlRead($data) & "\" & $search[$f])
        DirRemove(@scriptdir & "\Reminders\" & GuiCtrlRead($data))
        If GuiCtrlRead($date) = GuiCtrlRead($data) Then
            $index=_GuiCtrlListFindString($list1, StringTrimRight($search[$f], 4))
            _GuiCtrlListDeleteItem($list1, $index)
        EndIf
        $cuc = 0
        GuiDelete($gui4)
        GUiSetState()
        ExitLoop
        EndIf
    WEnd

        EndIf
        EndIf
        Next
    EndIf
    
    If GUiCtrlRead($check) = $GUI_UNCHECKED Then $var2 = 1
    
    If GuiCtrlRead($check) = $GUI_CHECKED Then
        If $var2 = 1 Then
        $gui3 = GuiCreate("Choose the alarm sound", 260, 95, -1, -1, $WS_POPUPWINDOW)
        $label2x = GuiCtrlCreateLabel("Choose a sound and/or preview it:", 10, 10)
        $open = GuiCtrlCreateButton("Choose", 10, 30)
        $songinput = GuiCtrlCreateInput($d, 60, 32, 187, 22)
        GuiCtrlSetState(-1, $GUI_DISABLE)
        $play = GuiCtrlCreateButton("Play sound", 120, 60)
        $stop = GuiCtrlCreateButton("Stop Sound", 184, 60)
        $accept = GuiCtrlCreateButton("Accept", 10, 60)
        GuiSetState()
        While 1
            
        $msg2 = GuiGetMsg()
            
            If $msg2 = $open Then 
                $namef=FileOpenDialog("Choose a sound:", @scriptdir & "\alarms\", "Mp3/Wav Files(*.mp3;*.wav)", 1)
                GUiCtrlSetData($songinput, $namef)
            EndIf
            
            If $msg2 = $play Then 
                $ss=_SoundOpen(GuiCtrlRead($songinput))
                _SoundPLay($ss)
                EndIf
            
            If $msg2 = $stop Then _SoundStop($ss)
            
            If $msg2 = $accept Then 
                $d = GuiCtrlRead($songinput)
                _SoundStop($ss)
                GuiDelete($gui3)
                GuiSetState(@SW_ENABLE, $gui2)
                $var2 = 0
                ExitLoop
            EndIf
            WEnd
        EndIf
        EndIf
    
If $var = 1 Then
    If GuiCtrlRead($birthday) = "Birthday" Then 
        GuiCtrlSetState($celeb, $GUI_SHOW)
        $var=0
    ElseIf $var = 1 Then
        GUiCtrlSetState($celeb, $GUI_HIDE)
        $var = 0
    EndIf
    EndIf
    
    If GUiCtrlRead($birthday) <> "Birthday" Then 
        GuiCtrlSetState($celeb, $GUI_HIDE)
        $var = 1
        EndIf
    
    If $Msg = $rAdd Then
    _Radd()
EndIf

$remlist=_FileListToArray(@scriptdir & "\Reminders\" & GuiCtrlRead($date), "*.*", 1)

If GuiCtrlRead($date) <> $read Then
    
    If IsArray($remlist) = 0 Then _GuiCtrlListClear($list1)
    
If IsArray($remlist) Then
    _GuiCtrlListClear($list1)
    $i=$remlist[0]
    
    For $s = 1 to $i
    _GuiCtrlListAddItem($list1, StringTrimRight($remlist[$s], 4))
Next

EndIf

EndIf

If _GUICtrlListSelectedIndex ($list1) = $LB_ERR Then
    Sleep(0)
    GuiCtrlSetData($ndt, "")
    GuiCtrlSetData($n, "")
    GuiCtrlSetData($t, "")
Else
    If $flicker <> _GUICtrlListGetText($list1, _GUICtrlListSelectedIndex ($list1)) & " | " & FileReadLine(@scriptdir & "\Reminders\" & GuiCtrlRead($date) & "\" & _GUICtrlListGetText($list1, _GUICtrlListSelectedIndex ($list1)) & ".rem", 1) & " | " & FileReadLine(@scriptdir & "\Reminders\" & GuiCtrlRead($date) & "\" & _GUICtrlListGetText($list1, _GUICtrlListSelectedIndex ($list1)) & ".rem", 2) Then GuiCtrlSetData($ndt, _GUICtrlListGetText($list1, _GUICtrlListSelectedIndex ($list1)) & " | " & FileReadLine(@scriptdir & "\Reminders\" & GuiCtrlRead($date) & "\" & _GUICtrlListGetText($list1, _GUICtrlListSelectedIndex ($list1)) & ".rem", 1) & " | " & FileReadLine(@scriptdir & "\Reminders\" & GuiCtrlRead($date) & "\" & _GUICtrlListGetText($list1, _GUICtrlListSelectedIndex ($list1)) & ".rem", 2))
    
    $flicker = GuiCtrlRead($ndt)
    
    If $flicker1 <> FileReadLine(@scriptdir & "\Reminders\" & GuiCtrlRead($date) & "\" & _GUICtrlListGetText($list1, _GUICtrlListSelectedIndex($list1)) & ".rem", 3) Then GuiCtrlSetData($t, FileReadLine(@scriptdir & "\Reminders\" & GuiCtrlRead($date) & "\" & _GUICtrlListGetText($list1, _GUICtrlListSelectedIndex ($list1)) & ".rem", 3))
    
    $flicker1 = GuiCtrlRead($t)
    
    If $flicker2 <> FileReadLine(@scriptdir & "\Reminders\" & GuiCtrlRead($date) & "\" & _GUICtrlListGetText($list1, _GUICtrlListSelectedIndex($list1)) & ".rem", 4) Then GuiCtrlSetData($n, FileReadLine(@scriptdir & "\Reminders\" & GuiCtrlRead($date) & "\" & _GUICtrlListGetText($list1, _GUICtrlListSelectedIndex ($list1)) & ".rem", 4))
    
    $flicker2 = GuiCtrlRead($n)
EndIf

If $msg = $Remove Then 
    FileDelete(@scriptdir & "\Reminders\" & GuiCtrlRead($date) & "\" & _GUICtrlListGetText($list1, _GUICtrlListSelectedIndex($list1)) & ".rem")
    DirRemove(@scriptdir & "\Reminders\" & GuiCtrlRead($date))
    _GUICtrlListDeleteItem($list1, _GUICtrlListSelectedIndex($list1))
EndIf

If $msg = $Edit Then
    If _GuiCtrlListSelectedIndex($list1) = $LB_ERR Then
        Sleep(0)
        Else
    $str4=StringSplit(GuiCtrlRead($ndt), "|")
    If IsArray($str4) = 1 Then 
        $str5=StringTrimLeft(StringTrimRight($str4[2], 1), 1)
    GuiCtrlSetData($RAdd, "Edit")
    GuiCtrlSetData($Rname, _GuiCtrlListGetText($list1, _GuiCtrlListSelectedIndex($list1)))
    GuiCtrlSetData($hour, FileReadLine(@scriptdir & "\Reminders\" & $str5 & "\" & _GUICtrlListGetText($list1, _GUICtrlListSelectedIndex($list1)) & ".rem", 2))
    GuiCtrlSetData($celeb, StringTrimRight(StringTrimLeft(FileReadLine(@scriptdir & "\Reminders\" & $str5 & "\" & _GUICtrlListGetText($list1, _GUICtrlListSelectedIndex($list1)) & ".rem", 3), 9), 1))
    GuiCtrlSetData($date1, $str5)
    GuiCtrlSetData($notes, FileReadLine(@scriptdir & "\Reminders\" & $str5 & "\" & _GUICtrlListGetText($list1, _GUICtrlListSelectedIndex($list1)) & ".rem", 4))
    If FileReadLine(@scriptdir & "\Reminders\" & GuiCtrlRead($date1) & "\" & GUICtrlReaD($Rname) & ".rem", 5) <> "" Then
    $var2 = 0
    GuiCtrlSetState($check, $GUI_CHECKED)
    $d = FileReadLine(@scriptdir & "\Reminders\" & GuiCtrlRead($date1) & "\" & GUICtrlReaD($Rname) & ".rem", 5)
    EndIf
    GuiSetState(@SW_SHOW, $gui2)
    EndIf
EndIf
EndIf
    
$read = GuiCtrlRead($date)

    WEnd
    
Func _Radd()
    If $exists = 0 Then
    If GuiCtrlRead($Rname) <> "" Then
    If GuiCtrlRead($radd) = "Edit" Then
    $str=StringSplit(GuiCtrlRead($ndt), "|")
    If IsArray($str) = 1 Then $str2=StringTrimLeft(StringTrimRight($str[2], 1), 1)
    FileDelete(@scriptdir & "\Reminders\" & $str2 & "\" & _GUICtrlListGetText($list1, _GUICtrlListSelectedIndex($list1)) & ".rem")
    DirRemove(@scriptdir & "\Reminders\" & $str2)
    
    DirCreate(@scriptdir & "\Reminders\" & GuiCtrlRead($date1) & "\")
    _FileCreate(@scriptdir & "\Reminders\" & GuiCtrlRead($date1) & "\" & GUICtrlReaD($Rname) & ".rem")
        
    _FileWriteToLine(@scriptdir & "\Reminders\" & GuiCtrlRead($date1) & "\" & GUICtrlReaD($Rname) & ".rem", 1, GuiCtrlRead($date1), 1)
    _FileWriteToLine(@scriptdir & "\Reminders\" & GuiCtrlRead($date1) & "\" & GUICtrlReaD($Rname) & ".rem", 2, GuiCtrlRead($hour), 1)
    If $var = 0 Then 
    _FileWriteToLine(@scriptdir & "\Reminders\" & GuiCtrlRead($date1) & "\" & GUICtrlReaD($Rname) & ".rem", 3, GuiCtrlRead($Birthday) & "(" & GuiCtrlRead($celeb) & ")", 1)
    Else
    _FileWriteToLine(@scriptdir & "\Reminders\" & GuiCtrlRead($date1) & "\" & GUICtrlReaD($Rname) & ".rem", 3, GuiCtrlRead($Birthday), 1)
    EndIf
    _FileWriteToLine(@scriptdir & "\Reminders\" & GuiCtrlRead($date1) & "\" & GUICtrlReaD($Rname) & ".rem", 4, GUICtrlRead($Notes), 1)
    If $d <> "" Then _FileWriteToLine(@scriptdir & "\Reminders\" & GuiCtrlRead($date1) & "\" & GUICtrlReaD($Rname) & ".rem", 5, $d, 1)
    If GuiCtrlRead($date1) = GuiCtrlRead($date) Then
    _GuiCtrlListReplaceString($list1, _GuiCtrlListSelectedIndex($list1), GuiCtrlRead($Rname))
Else
    _GuiCtrlListDeleteItem($list1, _GuiCtrlListSelectedIndex($list1))
    EndIf
    GuiCtrlSetData($Rname, "My Reminder")
    GuiCtrlSetData($hour, "12:00")
    GuiCtrlSetData($celeb, "")
    GuiCtrlSetData($notes, "My Notes")
    GuiSetState(@SW_HIDE, $gui2)
    GuiSetState(@SW_ENABLE, $gui)
    GuiCtrlSetData($radd, "Add")
Else
    GuiCtrlSetData($date1, GuiCtrlRead($data))
    DirCreate(@scriptdir & "\Reminders\" & GuiCtrlRead($date1) & "\")
    _FileCreate(@scriptdir & "\Reminders\" & GuiCtrlRead($date1) & "\" & GUICtrlReaD($Rname) & ".rem")
    _FileWriteToLine(@scriptdir & "\Reminders\" & GuiCtrlRead($date1) & "\" & GUICtrlReaD($Rname) & ".rem", 1, GuiCtrlRead($date1), 1)
    _FileWriteToLine(@scriptdir & "\Reminders\" & GuiCtrlRead($date1) & "\" & GUICtrlReaD($Rname) & ".rem", 2, GuiCtrlRead($hour), 1)
    If $var = 0 Then 
    _FileWriteToLine(@scriptdir & "\Reminders\" & GuiCtrlRead($date1) & "\" & GUICtrlReaD($Rname) & ".rem", 3, GuiCtrlRead($Birthday) & "(" & GuiCtrlReaD($celeb) & ")", 1)
    Else
    _FileWriteToLine(@scriptdir & "\Reminders\" & GuiCtrlRead($date1) & "\" & GUICtrlReaD($Rname) & ".rem", 3, GuiCtrlRead($Birthday), 1)
    EndIf
    _FileWriteToLine(@scriptdir & "\Reminders\" & GuiCtrlRead($date1) & "\" & GUICtrlReaD($Rname) & ".rem", 4, GUICtrlRead($Notes), 1)
    If $d <> "" Then _FileWriteToLine(@scriptdir & "\Reminders\" & GuiCtrlRead($date1) & "\" & GUICtrlReaD($Rname) & ".rem", 5, $d, 1)
    If GuiCtrlRead($date1) = GuiCtrlRead($date) Then _GuiCtrlListAddItem($list1, GuiCtrlRead($Rname))
    GuiCtrlSetData($Rname, "My Reminder")
    GuiCtrlSetData($hour, "12:00")
    GuiCtrlSetData($celeb, "")
    GuiCtrlSetData($notes, "My Notes")
    GuiSetState(@SW_HIDE, $gui2)
    GuiSetState(@SW_ENABLE, $gui)
EndIf
Else
    MsgBox(0, "Enter a name", "You must enter a name for the reminder.")
    EndIf
EndIf
$exists = 0
EndFunc

Share this post


Link to post
Share on other sites



Cool start, looking forward to the end result with menu and tray menu..

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Good work on what you have so far!

Never put a sleep in your main loop if you're using GuiGetMsg(). GuiGetMsg() automatically has a sleep so consequently another sleep just causes lag in your program.

EDIT: I would also recommend using Opt("GuiOnEventMode", 1). This would clean up you main loop a lot and leave it free to just check if it's time for a reminder.

Edited by Piano_Man

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

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