public
Last active

Simple relative-date LaunchBar -> Reminder.app

  • Download Gist
Remind.applescript
AppleScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
-------------------------
-- Display Alert 1.2 for LaunchBar 5
-- this script displays a large typed message after a given delay time
--
-- originally written by ludwigschubert http://forums.obdev.at/viewtopic.php?f=24&t=615
-- modified by Zettt (http://www.zettt.de) 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]]"
else
-- 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

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.