Jump to content

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

Birthday-reminder


  • Please log in to reply
No replies to this topic
mbirth
  • Members
  • 40 posts
  • Last active: Jul 31 2008 11:12 AM
  • Joined: 03 Oct 2005
This is meant to be launched through your StartUp-folder upon Windows logon. It shows upcoming birthdays in the next 5 days as a tray balloon. If there's an entry for today, additionally a message box will pop up.

; Birthday reminder

SplitPath A_ScriptFullPath, null, DataDir, null, DataFile, null
DataFile = %DataDir%\%DataFile%.dat

TipSecs = 5
TipIcon = 1

; %A_DDDD%, %A_DD%. %A_MMMM% %A_YYYY% (%A_DD%.%A_MM%.%A_YYYY%)

FormatTime TodayS, , dd.MM.
ShowMsg = 0

Loop read, %DataFile%
{
  SplitFirst(CurDate, CurText, A_LoopReadLine, " ")
  Loop 6
  {
    Advance := A_Index - 1
    CheckDate = %A_Now%
    CheckDate += %Advance%, days
    FormatTime CheckDateS, %CheckDate%, dd.MM.
    
    If (CurDate = CheckDateS)
    {
      If (StrLen(TipText) > 0)
        TipText = %TipText%`n
      If (CurDate = TodayS)
      {
        CheckDateS = HEUTE:
        TipIcon = 2
        ShowMsg = 1
      }
      TipText = %TipText%%CheckDateS% %CurText%
    }
  }
}

TrayTip Kommende Geburtstage (%TodayS%%A_YYYY%), %TipText%, %TipSecs%, %TipIcon%
If (ShowMsg = 1)
  MsgBox 4160, Geburtstage (%TodayS%%A_YYYY%), %TipText%

SleepSecs := TipSecs * 1000
Sleep SleepSecs

Exit



SplitFirst(ByRef OutLeft, ByRef OutRight, InpText, InpSep)
{
  StringGetPos SepPos, InpText, %InpSep%
  If (SepPos >= 0)
  {
    StringLeft OutLeft, InpText, %SepPos%
    RemChars := StrLen(InpText)-SepPos-1
    StringRight OutRight, InpText, %RemChars%
  }
  Else
  {
    OutLeft  := InpText
    OutRight := ""
  }
}

Save this as sched.ahk. The following should be then saved as sched.dat (same basename as script!).

02.01. John Doe
11.06. Jane Doe
24.12. Christmas eve

Have fun.

Cheers,
-mARKUS