Created
June 23, 2013 10:36
-
-
Save Zettt/5844568 to your computer and use it in GitHub Desktop.
Script to put a list of text from your clipboard in Reminders. Inspiration drawn from Drafts' "List to Reminders" feature. More info: (not published yet)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- get clipboard and separate lines | |
set clipboardText to the clipboard as text | |
set reminderLines to paragraphs of clipboardText | |
set defaultRemindersList to "Shoppinglist" | |
-- figure out if a non-default reminder list should be used | |
if item 1 of reminderLines starts with "!" then | |
-- set other reminder list and delete first line | |
set remindersList to characters 2 thru -1 of item 1 of reminderLines as text | |
set reminderLines to items 2 thru -1 of reminderLines | |
else | |
set remindersList to defaultRemindersList | |
end if | |
tell application "Reminders" | |
activate | |
-- create reminders | |
tell list remindersList | |
repeat with currentReminderLine in reminderLines | |
make new reminder with properties {name:currentReminderLine as text} | |
end repeat | |
end tell | |
end tell | |
-- optionally quit Reminders | |
tell application "System Events" | |
activate | |
set quitReminders to display dialog "Quit Reminders?" buttons {"No", "Yes"} default button "Yes" | |
if button returned of quitReminders is equal to "Yes" then | |
tell application "Reminders" to quit | |
else if button returned of quitReminders is equal to "No" then | |
-- if no is clicked, system events would still be active, so | |
-- let's activate Reminders again | |
tell application "Reminders" to activate | |
end if | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
is it possible to add other properties? id, note?