Action

Atomic Journal

Posted by jimmy_little, Last update about 2 months ago - Unlisted

Adds an “atomic journal” line to my log on the Daily Note in Obsidain

Steps

  • script

    // Specify the UUID of the draft
    var draftUUID = "620F76F4-42C8-4D64-8618-D5230B5CE7F4";
    
    // Get the draft by UUID
    var targetDraft = Draft.find(draftUUID);
    
    // Check if the draft exists
    if (targetDraft) {
        // Create a prompt
        var p = Prompt.create();
        p.title = "Select Role";
        p.message = "Select a role from the draft";
    
        // Split the draft content into lines
        var lines = targetDraft.content.split('\n');
    
        // Add a button for each line
        for (var i = 0; i < lines.length; i++) {
            p.addButton(lines[i]);
        }
    
        // Show the prompt
        if (p.show()) {
            // Get the label of the button pressed
            var selectedRole = p.buttonPressed;
    
            // Set the selected role as a template tag
            draft.setTemplateTag("myRole", selectedRole);
    
        }
    } else {
        alert("Draft not found with UUID: " + draftUUID);
    }
    
  • file

    fileNameTemplate
    [[created|%Y-%m-%d]].md
    folderTemplate
    Daily/[[created|%Y]]
    template
    | [[created|%H:%M]] | [[draft]] | [[myRole]] |
    local
    true
    writeType
    append

Options

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