Action
Get Link to Reminder
UPDATES
over 3 years ago
Changed default link from GoodTask to Reminders.
Run this action to choose a reminder and generate a direct link that opens the specific reminder in the Reminders app.
(Can also be configured to open in GoodTask by changing the first constant prefix
.)
When you run the action:
- You’ll choose a Reminders list from all available lists.
- You’ll choose an incomplete reminder from that list.
- You’ll choose to copy the new link to the clipboard or to replace the current selection with it.
Useful for attaching Reminders tasks to a project and referring back to them while writing in Drafts (or another app).
This can fairly easily be extended to enable creating a new reminder and then adding the link to it.
Steps
-
script
// ⚠️ If you want the link to open in Reminders: const prefix = "x-apple-reminderkit://REMCDReminder/" // ⚠️ If you want the link to open in GoodTask: //const prefix = "goodtask3://task?identifier=" const listObjects = ReminderList.getAllReminderLists() var lists = [] for (let l of listObjects) { lists.push(l.title) } // Show list prompt var p = Prompt.create() p.title = "Choose a List" p.message = `${lists.length} lists`; p.addSelect("listSelect", "List", lists, [lists[0]], false); p.addButton("Choose"); var didSelect = p.show(); var selectedListTitle = p.fieldValues["listSelect"]; var list = "" if (p.buttonPressed == "Choose") { list = ReminderList.find(selectedListTitle) getReminders() } // Get reminders function getReminders() { let incompleteTasks = list.incompleteTasks var reminders = [] var remTitles = [] for (let r of incompleteTasks) { reminders.push({ "title": r.title, "id": r.identifier }) remTitles.push(r.title) } // Show reminder prompt var p = Prompt.create() p.title = "Choose a Reminder" p.message = `${remTitles.length} incomplete reminders`; p.addSelect("remSelect", "Reminder", remTitles, [remTitles[0]], false); p.addButton("Copy Link"); p.addButton("Insert Link"); var didSelect = p.show(); var selectedRemTitle = p.fieldValues["remSelect"]; var selectedRemID = "" for (let r of reminders) { if (r.title == selectedRemTitle) { selectedRemID = r.id break } } // GENERATE LINK if (p.buttonPressed == "Copy Link") { copyLink(selectedRemID) app.displaySuccessMessage("Link copied!"); } else if (p.buttonPressed == "Insert Link") { insertLink(selectedRemID) } } // == FUNCTIONS == function copyLink(id) { let link = prefix + id app.setClipboard(link) } function insertLink(id) { let link = prefix + id editor.setSelectedText(link) }
Options
-
After Success Default Notification Info Log Level Info
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.