Folks,
The above script inspired me to work on a slight modification that allows long reminders and short multi-line reminders. See the code below.
Code:
;
; Reminder.ahk
;
; Script Description:
;
; This script was inspired by keyboardfreak (Reference: http://www.autohotkey.com/forum/topic45738.html)
; It loads in a set of reminders from the Reminders.txt file, one per line. The syntax is as follows:
;
; text1/time1
; text2/time2
; text3/time2
;
; Times are specified in minutes. Multi-line reminders can be achieved by adding `n to the text
;
; The script uses the SplashMe scripts to display the reminders
; (Reference: Reference: http://www.autohotkey.com/forum/topic18040.html)
;
; --------------------------------------------------------------------------------------------------
;
; Change the tray icon tip
Menu, Tray, Tip, Reminder
;
; Show starting splash window in bottom right corner
;
SplashOn("","Starting Reminder ...",0,"","XR YB")
Sleep 1000
;
; Setup the parameters
;
SplashTime := 10*1000 ; Display the reminders for 10 seconds
SplashFont := ""
SplashOptions := "FS14 CWLime" ; Options for SplashImage, e.g. CWRed - Don't include X or Y coordinates
;
; Get the working width and height of the screen
;
SysGet, Pos, MonitorWorkArea
WorkingWidth := PosRight - PosLeft ; Calculate the working width of the screen
WorkingHeight:= PosBottom - PosTop ; Calculate the working height of the screen
;
; Update the working width and height of the screen when there is a display change
;
OnMessage(0x7E, "WM_DISPLAYCHANGE")
WM_DISPLAYCHANGE()
{
global
SysGet, Pos, MonitorWorkArea
WorkingWidth := PosRight - PosLeft ; Calculate the working width of the screen
WorkingHeight:= PosBottom - PosTop ; Calculate the working height of the screen
Return true ; Tell the OS to allow the display change to continue
}
;
; Set the splash window coordinates so that the window is off the screen (X = WorkingWidth, Y = WorkingHeight)
; This is simply a trick to get the dimensions of the splash window so that they can be used later on
;
AllSplashOptions := SplashOptions . " X" . WorkingWidth . " Y" . WorkingHeight
AllSplashOptions = %AllSplashOptions% ; Trim whitespaces at either end in case SplashOptions is blank
;
; Read reminders from file and parse the information
;
Schedules := 0
Loop, Read, Reminders.txt
{
Schedules += 1
StringSplit, Field, A_LoopReadLine, /
Text%A_Index% := Field1
StringReplace, Text%A_Index%, Text%A_Index%, ``n, `n, All
Period%A_Index% := Field2
Counter%A_Index% := Field2
SplashOn("",Text%A_Index%,0,SplashFont,AllSplashOptions)
WinGetPos, , , Width%A_Index%, Height%A_Index%, SplashOnWindow
}
;
; Quickly run through all the reminders once at the start
;
Loop %Schedules%
{
Random, X, , % WorkingWidth - Width%A_Index%
Random, Y, , % WorkingHeight - Height%A_Index%
AllSplashOptions := SplashOptions . " X" . X . " Y" . Y
AllSplashOptions = %AllSplashOptions%
SplashOn("",Text%A_Index%,0,SplashFont,AllSplashOptions)
Sleep 1000
SplashOff()
}
;
; Now start a timer so that every minute the reminder counter is checked against its period
;
SetTimer, CountDown, % 60*1000 ; Set the counter period to 1 minute
Return
CountDown:
Loop %Schedules%
{
Counter%A_Index% -= 1
if (Counter%A_Index% = 0)
{
Random, X, , % WorkingWidth - Width%A_Index%
Random, Y, , % WorkingHeight - Height%A_Index%
AllSplashOptions := SplashOptions . " X" . X . " Y" . Y
AllSplashOptions = %AllSplashOptions%
SplashOn("",Text%A_Index%,0,SplashFont,AllSplashOptions)
Sleep Splashtime
SplashOff()
Counter%A_Index% := Period%A_Index%
}
}
Return
#p::
Pause
Return
Exit:
SplashOff()
ExitApp
#Include Library
#Include Splash Me.ahk ; Defines a set of functions to generate splash windows
Thank you keyboardfreak for the inspiration.