Google Maps search

Posted by jsnmrs, Last update 12 days ago

Search Google Maps, 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 Google Maps app.
    var result = app.openURL("googlemaps://?q=" + encodeURIComponent(lookupText), false)
    
    // If app launch failed, show Google Maps in inline browser.
    
    if (!result) {
      openURL = app.openURL("https://www.google.com/maps/search/" + encodeURIComponent(lookupText), true)
    }

Options

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