Action

URL Cursor (copy)

Posted by @derekvan, Last update 7 months ago - Unlisted

Steps

  • script

    var selRange = editor.getSelectedLineRange();
    var str = editor.getTextInRange(selRange[0],selRange[1]);
    
    var testUrl = str.match(/(https?:\/\/)?[\w\-~]+(\.[\w\-~]+)+(\/[\w\-~@:%]*)*(#[\w\-]*)?(\?[^\s]*)?/);
    const URL = new String (testUrl[0]);
    console.log(URL);
    app.openURL(URL);

Options

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