Inspired by this post I've written two other scripts people might find useful.
The first one I call "Schedule" -- it works the same way as Remind but the last argument is the *time* at which you want the reminder to display rather than the duration until reminder.
e.g. Cmd-Space - type Schedule - press Space - type "Start making dinner 5:30pm" - press Enter
At 5:30pm you will get a large text alert showing whatever string you put in (note that the am/pm designation *is* required, you must use a colon between hours and minutes, and it does not accept 24 hour time [i.e. 13:30]).
- Code: Select all
on handle_string(msg)
set wordCount to count words of msg
set timeArray to words (wordCount - 1) thru wordCount of msg
set timeString to item 1 in timeArray & ":" & item 2 in timeArray as string
set duration to (date timeString) - (date (time string of (current date))) & "s" as string
set mLength to (count characters of msg)
set dLength to ((count characters of item 1 in timeArray) + (count characters of item 2 in timeArray) + 1)
set reminder to (characters 1 thru (mLength - dLength) of msg) as string
tell application "LaunchBar"
display in large type reminder after delay duration
delay
end tell
end handle_string
The second script is quite a bit more complicated, but what it does is something of a fusion of Remind and Schedule. It will display your reminder every <interval> until <end time>. I call it "Snooze" since it's a lot like the snooze function on an alarm clock.
e.g. Cmd-Space - type Snooze - press Space - type "Are you studying? You should be every 5m until 6:30pm" - press Enter
This will display "Are you studying? You should be" every 5 minutes until 6:30pm (weird!). The way it handles imperfect time divisions is begin alerting you every <interval> (in the example 5 minutes) from execution and then one final time at the end time. All of the reminders will display without a time alert except the last one, which dings so that you know you're through being reminded.
It requires that you use the syntax: <message> every <interval> until <end time>
<interval> can be specified in seconds (30s), minutes (5m), or hours (1h). If you leave off the specifier for duration (s/m/h) it will assume minutes.
<end time> must be specified the same as the above script -- it requires the colon and am/pm and does not accept 24 time.
- Code: Select all
on handle_string(msg)
set wordArray to words of msg
repeat with i from 1 to count words of msg
if item i in wordArray is "every" then
set everyNum to i
else if item i in wordArray is "until" then
set untilNum to i
end if
end repeat
set intervalString to (item (everyNum + 1) in wordArray) as string
set hourString to item (untilNum + 1) in wordArray as string
set minString to item (untilNum + 2) in wordArray as string
set reminderLength to -1 as number
repeat with i from 1 to (everyNum - 1)
set reminderLength to reminderLength + (count characters of item i in wordArray) + 1
end repeat
set reminder to (characters 1 thru reminderLength of msg) as string
if ("s" is last character in intervalString) or ("m" is last character in intervalString) or ("h" is last character in intervalString) then
set timeMod to last character in intervalString
set repeatLength to (count characters of intervalString)
set repeatDelay to (characters 1 thru (repeatLength - 1) of intervalString) as string
if timeMod is "s" then
set repeatDelay to repeatDelay as number
else if timeMod is "m" then
set repeatDelay to repeatDelay * 60 as number
else if timeMod is "h" then
set repeatDelay to repeatDelay * 360 as number
end if
else
set repeatDelay to (intervalString * 60) as number
end if
set timeString to hourString & ":" & minString as string
set totalDuration to (date timeString) - (date (time string of (current date))) as string
set loopNum to (round (totalDuration / repeatDelay) rounding down) as number
repeat with i from 1 to loopNum
tell application "LaunchBar"
display in large type reminder after delay (repeatDelay * i)
end tell
end repeat
tell application "LaunchBar"
display in large type reminder after delay totalDuration with sound "Glass"
end tell
end handle_string
Both of these scripts will fail if you garble the time syntax or the interval syntax, I don't think they can/will do any damage to LaunchBar and I've not built in any way to quit the reminders once you set them (this is important for Snooze). Although quitting LaunchBar and restarting ought to work.