Action

inbox todays tickler drafts

Posted by FlohGro, Last update about 12 hours ago

created by @FlohGro / more on my Blog

inbox todays tickler drafts

Searches through the archive of drafts for drafts that contain the text [tickler:YYYY-MM-DD] (where YYYY-NN-DD is the current date) and unarchives the found drafts.

Can be used to automatically return drafts to the inbox on a certain date. You can automate this action to run once a day (or when you open drafts,..).

Best use together with the insert tickler date action


If you find this useful and want to support me you can donate or buy me a coffee

Steps

  • script

    let today = new Date();
    let yyyy = today.getFullYear();
    let mm = String(today.getMonth() + 1).padStart(2, '0'); // Months are 0-based
    let dd = String(today.getDate()).padStart(2, '0');
    let dateString = `${yyyy}-${mm}-${dd}`;
    
    let searchQuery = `[tickler:${dateString}]`;
    
    let matchingDrafts = Draft.query(searchQuery, "archive");
    
    
    matchingDrafts.forEach(d => {
            d.isArchived = false; // Unarchive the draft
            d.update(); // Save the changes
    });
    
    app.displayInfoMessage(`${matchingDrafts.length} drafts unarchived.`);
    console.log(`${matchingDrafts.length} drafts unarchived.`);

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.