Short Script to complete and delete a reminder

#1

Hi!

I’ve just started scripting. I use reminders + shortcuts on a lot on my daily routine. At the beginning of the day, I run a shortcut that sets reminders of things I need to do at certain hours, some of them being another shourtcuts. As part of the shortcut triggered by the reminder, I delete the reminder, but due to shortcut limitations, I need to press confirm to delete it.

This is where the following simple script gives my an extra. I have replaced the “delete reminder” blocks of my shortcuts, and using the pasteboard, pass a string to the script. The script then compares it to the existing reminders, complete it and delete it.

It’s a really simple script, but it may help someone.

var reminder = Pasteboard.pasteString();

let all = await Reminder.all();
for (let r of all) {
    if (r.title == reminder){
      r.isCompleted = true;
      r.remove();
    }
}

Safari.open("shortcuts://");

This links shows an example of what is to be used in shortcuts: https://www.icloud.com/shortcuts/ea499336cc6340cbb4e5805eea077eb4

Just remember to change the name in the url to match the name of your script.

1 Like

#2

Do you ever foresee a situation where you could have issues with reminders that could have identical titles but be different, and entirely valid, reminders?

I’m just wondering if it would be prudent to try and be more specific with the reminder attributes to try and reduce any ambiguous/erroneous completions from occurring?

The dates might be useful for example, or if you had some unique identifier string in the notes each time perhaps?

3 Likes

#3

As part of my routine, I only have unique named reminders. However, I see your point.

I am planing to move that routines to something else, as I do not like the way reminders manages urls.

I will have a look onto adding some kind of filtering on the script, as you said, taking into account the actual date would be a good starting point.

0 Likes