Action

Better IMDb Search

Posted by Greg S, Last update over 6 years ago

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

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
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.