Skip to content

Instantly share code, notes, and snippets.

@Tomfox91
Created February 8, 2015 11:28
Show Gist options
  • Save Tomfox91/7ea8cfa96e0c8588774d to your computer and use it in GitHub Desktop.
Save Tomfox91/7ea8cfa96e0c8588774d to your computer and use it in GitHub Desktop.
Script to sort alphabetically the completed reminders in Apple Reminders. Written in JavaScript (works in Yosemite).
var listName = '<list name>'
var Reminders = Application('Reminders');
var list = Reminders.lists.byName(listName);
var done = [];
var reminders = list.reminders.whose({completed: true});
var rl = reminders.length;
Progress.totalUnitCount = 2 * rl;
for (var i = 0; i < reminders.length; ++i) {
var n = reminders[i].name();
if (done.indexOf(n) >= 0) {
reminders[i].delete();
} else {
done.push(n);
}
Progress.completedUnitCount = i;
}
done.sort().reverse();
for (var i = 0; i < done.length; ++i) {
list.reminders.byName(done[i]).completionDate = new Date(1000 * i);
Progress.completedUnitCount = rl+i;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment