Action

Google Maps search

Posted by jsnmrs, Last update over 4 years 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 , Tags: search
    Notification Info
    Log Level Info
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.