function run(input, parameters) {
// set things up
var app = Application('Reminders');
app.includeStandardAdditions = true;
// choose list
var listName = app.chooseFromList(app.lists.name(), { withPrompt: "Which List?" });
if (listName) {
// get the data from the list
var remindersList = app.lists.byName(listName).reminders;
var listNames = remindersList.name();
var listCompleted = remindersList.completed();
var listDueDates = remindersList.dueDate();
var listBodies = remindersList.body();
// create a single array
var list = [];
for(var i=0; i<listNames.length; i++) {
list.push({name: listNames[i], completed: listCompleted[i], dueDate: listDueDates[i], body: listBodies[i]});
}
// sort the list
//list.sort((a, b) => (a.name > b.name));
list.sort((a, b) => (a.dueDate > b.dueDate));
// build text from list
var text = "";
var n = 0;
for(var i=0; i<list.length; i++) {
// get item item including due date and notes
var item = list[i].name;
if (list[i].dueDate) item += " [Due: " + list[i].dueDate + "]";
if (list[i].body) item += " [Note: " + list[i].body + "]";
// non-completed items
if (!list[i].completed) {
text += "☐ " + item + "\n";
n++;
// completed items
} else {
//text += "☑ " + item + "\n";
//n++;
}
}
// pass to clipboard
app.setTheClipboardTo(text);
// show message
app.displayAlert("Reminders Copied", { message: n+" copied to the clipboard." });
}
return input;
}
how to import the text file into reminders again.Use Automator to make a Workflow with this Javascript, then add the Workflow as a service in Reminders.
You can see it in my screenshot. Run the service and you will get the text of your reminders copied to the clipboard. Paste that into a .txt file and you are good to go.
View attachment 2462609
Code:function run(input, parameters) { // set things up var app = Application('Reminders'); app.includeStandardAdditions = true; // choose list var listName = app.chooseFromList(app.lists.name(), { withPrompt: "Which List?" }); if (listName) { // get the data from the list var remindersList = app.lists.byName(listName).reminders; var listNames = remindersList.name(); var listCompleted = remindersList.completed(); var listDueDates = remindersList.dueDate(); var listBodies = remindersList.body(); // create a single array var list = []; for(var i=0; i<listNames.length; i++) { list.push({name: listNames[i], completed: listCompleted[i], dueDate: listDueDates[i], body: listBodies[i]}); } // sort the list //list.sort((a, b) => (a.name > b.name)); list.sort((a, b) => (a.dueDate > b.dueDate)); // build text from list var text = ""; var n = 0; for(var i=0; i<list.length; i++) { // get item item including due date and notes var item = list[i].name; if (list[i].dueDate) item += " [Due: " + list[i].dueDate + "]"; if (list[i].body) item += " [Note: " + list[i].body + "]"; // non-completed items if (!list[i].completed) { text += "☐ " + item + "\n"; n++; // completed items } else { //text += "☑ " + item + "\n"; //n++; } } // pass to clipboard app.setTheClipboardTo(text); // show message app.displayAlert("Reminders Copied", { message: n+" copied to the clipboard." }); } return input; }
can you provide a shortcut copied somewhere (like iCloud Drive), which can be clicked to import straightaway into the Shortcuts app (sorry, was just trying to reduce my work).Basic outline to create a CSV of all Reminders in Shortcuts attached. And an example of how to read in a basic CSV file.
But no Shortcut that does it all. Need to craft your own solution.
And one thing I don't like about CSVs is that need to deal with commas in values, ie need to quote on output, strip out quotes when reading in, as no native CSV parser in Shortcuts. Dictionary files are a cleaner way of doing it as Shortcuts handles the parsing/processing of value, but a bit more overhead (read: a little more busy code).
I am not aware of a way to import them back in.how to import the text file into reminders again.
any shortcut/ automation for importing as well?
I have about 1600 reminders in my list. related to multiple organizations I am dealing with. so for me importing is essential in case of disaster.I am not aware of a way to import them back in.
In my case, I have 15 reminder items going out almost three years, so if disaster struck and somehow they disappeared, I guess I could manually reenter everything from my text file I have backed up in multiple places.
I sync using iCloud and have never lost any reminder data, so hopefully I'll never have to use my text file backup.
a reminder shows up in calendar app only if it has "remind me" activated on a day etc.I just noticed something new that might work for you. A recent OS update allowed the display of reminders in the Calendar app. If I select one of those reminders in the Calendar, then go to export, it creates a.ics file of the reminders. I'm assuming this could be imported. You might try exporting these, then make a test account on your Mac to try out importing to Calendar. I'd be curious if you import these into the Calendar if it also puts them back in the Reminders app.
View attachment 2463410
View attachment 2463412