Drafts Action Directory

Better IMDb Search

Posted by Greg S, Last update 3 months ago

Search IMDb, using either the app (if installed) or the inline browser (if app is not detected).

Install

Steps

  • script

    // Get the selected text from the Draft.
    // If no text is selected, get entire Draft.
    
    const selectedText = editor.getSelectedText();
    var lookupText;
    if (selectedText && selectedText!=="") {
    	lookupText = selectedText;
    } else {
    	lookupText = editor.getText();
    }
    
    // Attempt to launch IMDB app.
    
    var result = app.openURL("imdb:///find?q=" + encodeURIComponent(lookupText), false)
    
    // If app launch failed, show IMDB in inline browser.
    
    if (!result) {
      openURL = app.openURL("https://www.imdb.com/find?q=" + encodeURIComponent(lookupText), true)
    }

Options

  • After Success Trash
    Notification Info
    Log Level Info

Comments

Actions available in the Action Directory are uploaded by community members. Use appropriate caution reviewing downloaded actions before use.