Import URL

Posted by agiletortoise, Last update about 1 year ago

Prompt for a URL and download the raw content of that URL and place it in a new draft.


  • script

    // import content of a URL
    // prompt for URL
    let p = Prompt.create();
    p.title = "Import URL";
    p.message = "Enter URL to import"
    let initialText = "";
    // use clipboard if it's a URL
    let clipboard = app.getClipboard();
    if (clipboard.startsWith("http")) {
    	initialText = clipboard;
    p.addTextField("url", "URL", initialText, {"autocorrect": false, "autocapitalization": false});
    if ( { // display prompt
    	// get url and load with HTTP GET request
    	let url = p.fieldValues["url"];
    	let http = HTTP.create();
    	let response = http.request({
    		"url": url,
    		"method": "GET"
    	if (response.success) {
    		// if response came back, create new draft
    		let text = response.responseText;
    		let d = Draft.create();
    		d.content = text;
    	else {;
    else {


  • After Success Default
    Notification Info
    Log Level Error
Actions available in the Action Directory are uploaded by community members. Use appropriate caution reviewing downloaded actions before use.