Send selected lines to iOS Reminders

Posted by @scripts4drafts, Last update almost 5 years ago

[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 ?


  • 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 = (line) {
      let reminder = list.createReminder();
      reminder.title = line.trim();
      reminder.notes = new Date().toISOString(); // date or whatever you want
      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);
    // activate is not required if the action is launched via a keyboard button


  • 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.