Action

Read current item

Posted by tommertron, Last update over 3 years ago - Unlisted

Get the first link in a draft and open it, and flag the draft.

Steps

  • script

    // based on https://stackoverflow.com/questions/33211233/how-to-detect-and-get-url-on-string-javascript
    // for an alternative method: see https://stackoverflow.com/questions/11209016/javascript-extract-urls-from-string-inc-querystring-and-return-array
    
    let matches = draft.content.match(/\bhttps?:\/\/\S+/gi);
    let first_match = matches[0];
    
    draft.isFlagged = true;
    draft.update();
    
    // uncomment to check matches 
    // alert(matches[0])
    
    app.openURL(matches[0])

Options

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