Skip to content

Instantly share code, notes, and snippets.

Created November 22, 2012 03:24
What would you like to do?
Simple relative-date LaunchBar ->
-- Display Alert 1.2 for LaunchBar 5
-- this script displays a large typed message after a given delay time
-- originally written by ludwigschubert
-- modified by Zettt ( at 2009-05-04
-- thanks to ptujec for providing additional information about changed AppleScript terms
-- Usage: Call LaunchBar, Hit Space, Input your message and provied your delay time at the end in "3s", "1m" or "2d" (without quotes)
-- Example: "This is an example message 2s" (without quotes)
-- 05/11/09 really minor change by ptujec - just added sound
on handle_string(message)
tell application "LaunchBar"
if message = "help" then
display in large type "My reminder [#[hms]]"
-- set time ... it's the last word of your string e.g. 'test 3'
set delay_time to last word of message
set future_message to message as text
-- strip away last word of message
set delay_time_length to length of delay_time
set message_length to length of future_message
set future_message to (characters 1 thru (message_length - delay_time_length) of future_message) as string
tell application "Reminders"
set _reminders to list "Reminders"
set d to current date
set _inc to last text item of delay_time
set _quant to text items 1 through ((count of text items of delay_time) - 1) of delay_time as string
if _inc is "d" then
set day of d to ((day of d) + _quant)
else if _inc is "h" then
set hours of d to ((hours of d) + _quant)
else if _inc is "m" then
set minutes of d to ((minutes of d) + _quant)
end if
make new reminder at end of _reminders with properties {name:future_message, remind me date:d}
end tell
end if
end tell
end handle_string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment