Action

Open current draft's first URL

Posted by @jsamlarose, Last update about 4 years ago - Unlisted

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]
    
    // 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.