Action
Send selected lines to iOS Reminders
[Basic script for @draftsapp] How to send multiple selected lines as tasks in iOS Reminders, edit each line and move the cursor to the end of the last line ?
Steps
-
script
let [loc, len] = editor.getSelectedLineRange(), str = editor.getTextInRange(loc, len).replace(/\n$/, ''), lines = str.split('\n'), icon = '?', reminderList = 'Inbox', // pick the Reminders list you want list = ReminderList.findOrCreate(reminderList), reminder = list.createReminder(); lines = lines.map(function (line) { let reminder = list.createReminder(); reminder.title = line.trim(); reminder.notes = new Date().toISOString(); // date or whatever you want reminder.update(); return icon + ' ' + line; }); let newStr = lines.join('\n'); editor.setTextInRange(loc, len, newStr); // move the cursor to the end of the edited line editor.setSelectedRange(loc + newStr.trim().length, 0); editor.setSelectedText(''); // activate is not required if the action is launched via a keyboard button editor.activate();
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.