Drafts Action Directory

Send selected lines as one task in iOS Reminders

Posted by @scripts4drafts, Last update 6 days ago

[Basic script for @draftsapp] How to send multiple selected lines as one task in iOS Reminders, edit the first line and move the cursor to the end of the last line ?

The task title is the first line of selection ; its body is the other lines of selection.



  • script

    let [loc, len] = editor.getSelectedLineRange(),
      str = editor.getTextInRange(loc, len).replace(/\n$/, ''),
      lines = str.split('\n'),
      title = lines[0],
      body = lines.slice(1).join('\n'),
      icon = '🔘',
      reminderList = 'Inbox', // pick the Reminders list you want
      list = ReminderList.findOrCreate(reminderList),
      reminder = list.createReminder();
    reminder.title = title.trim(); // trim gets rid of end of line (\n), if any
    reminder.notes = body;
    let newStr = icon + ' ' + str;
    editor.setTextInRange(loc, len, newStr);
    // move the cursor to the end of the edited line
    editor.setSelectedRange(loc + newStr.trim().length, 0);
    // activate is not required if the action is launched via a keyboard button


  • After Success Default
    Notification Info
    Log Level Info


Actions available in the Action Directory are uploaded by community members. Use appropriate caution reviewing downloaded actions before use.