Action

Send Markdown Tasks to Things

Posted by SimonB, Last update about 5 hours ago

UPDATES

about 5 hours ago

I use this to extract tasks from the AI revised transcript from my notes app

Script that looks for unchecked task items ( - [ ] ) removes the checkbox and transfers to Things using the note’s title as the name of the Things task and the tasks as subtasks.

Steps

  • script

    // Get draft title and content
    let title = draft.title.trim();
    let text = draft.content;
    
    // Split content into lines
    let lines = text.split("\n");
    
    let checklist = [];
    
    // Extract ONLY unchecked markdown tasks
    for (let line of lines) {
        if (line.startsWith("- [ ] ")) {
            let item = line.replace("- [ ] ", "").trim();
            if (item.length > 0) {
                checklist.push(item);
            }
        }
    }
    
    // Only proceed IF tasks exist
    if (checklist.length > 0) {
    
        let checklistText = checklist.join("\n");
    
        let encodedTitle = encodeURIComponent(title);
        let encodedChecklist = encodeURIComponent(checklistText);
        let encodedTag = encodeURIComponent("Cleft");
    
        let url = `things:///add?title=${encodedTitle}&checklist-items=${encodedChecklist}&tags=${encodedTag}`;
    
        app.openURL(url);
    
        // Archive draft after sending
        draft.isArchived = true;
        draft.update();
    
    } else {
    
        app.displayInfoMessage("No unchecked tasks found.");
    }

Options

  • After Success Default
    Notification Info
    Log Level Info
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.