Action

Random Draft

Posted by David Blue, Last update about 2 years ago - Unlisted

Opens a random draft in the editor. Offered by FlohGro in response to this forum thread.

Steps

  • script

    // query all drafts with any tag (filter out the current open draft) 
    const allDrafts = Draft.query("", "all",[]).filter(d => d.uuid != draft.uuid)
    // get a random draft from the allDrafts array by creating a random number between 0 and the count of drafts in allDrafts
    const randomDraft = allDrafts[Math.floor(Math.random() * allDrafts.length)]
    // load the random draft into the editor
     editor.load(randomDraft)

Options

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