Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*{
- "author": "Rosemary Orchard",
- "targets": ["omnifocus"],
- "type": "action",
- "identifier": "com.rosemaryorchard.process-inbox-tasks",
- "version": "0.1",
- "description": "A plug-in to help me automatically process tasks in my inbox by adding tags and replacing text.",
- "label": "Process Inbox Tasks",
- "mediumLabel": "Process Inbox Tasks",
- "paletteLabel": "Process Inbox Tasks",
- }*/
- (() => {
- var action = new PlugIn.Action(function(selection, sender){
- document.windows[0].perspective = Perspective.BuiltIn.Inbox
- inbox.forEach(function(task){
- if (task.name.startsWith('--')) {
- let newTask = Task.byParsingTransportText(task.name);
- newTask.note = task.note;
- deleteObject(task);
- } else if (task.name.includes(" - IKEA") && task.note.includes("https://www.ikea.com")) {
- let ikeaTag = tagsMatching('Ikea')[0];
- task.name = task.name.replace(" - IKEA", "");
- task.addTag(ikeaTag);
- } else if (task.name.includes(" | Wilko") && task.note.includes("https://www.wilko.com")) {
- let wilkoTag = tagsMatching('Wilko')[0];
- task.name = task.name.replace(" | Wilko", "").replace("Wilko", "").trim();
- task.addTag(wilkoTag);
- } else if (task.name.includes(" | Argos") && task.note.includes("https://www.argos.co.uk")) {
- let wilkoTag = tagsMatching('Argos')[0];
- task.name = task.name.replace(" | Argos", "");
- task.addTag(wilkoTag);
- } else if (task.name.includes(" - B&M") && task.note.includes("https://www.bmstores.co.uk")) {
- let wilkoTag = tagsMatching('B&M')[0];
- task.name = task.name.replace(" - B&M", "");
- task.addTag(wilkoTag);
- } else if (task.name.includes(" | Morrisons") && task.note.includes("morrisons.com")) {
- let supermarketTag = tagsMatching('🛒 Supermarket')[0];
- let morrisonsTag = tagsMatching("Morrisons")[0];
- task.name = task.name.replace(" | Morrisons", "");
- task.addTag(supermarketTag);
- task.addTag(morrisonsTag);
- }
- task.name = task.name.replace(" ", " ").trim(); //replace any double spaces left, and remove any spaces before or after the text
- })
- });
- action.validate = function(selection, sender){
- return (inbox.length > 0)
- };
- return action;
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement