Action
Copy Incomplete Tasks
Posted by jochi,
Last update
about 2 months ago
Copy all SimpleTask tasks that are unchecked but have not been sturck through e.g.
- [ ] Task to ignore
Steps
-
script
const selection = draft.processTemplate("[[selection]]"); const task_re = /^- \[ \] (?!~~)(?!\s*$).*/gm; // Regex to match unchecked tasks, ignoring items that have been struck through let getUncheckedTasks = (s) => { let raw_tasks = s.match(task_re); return raw_tasks ? raw_tasks.join("\n") : ""; }; const tasks = getUncheckedTasks(selection); if (tasks == null || tasks == "") { throw new Error("No unchecked tasks found. Please check that the content contains Simple List items."); } // Count the number of tasks const taskCount = tasks.split("\n").length; app.setClipboard(tasks); app.displaySuccessMessage(`${taskCount} tasks were copied to the clipboard!`);
Options
-
After Success Nothing Notification None Log Level Info
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.