Open URL or Search Using Google Chrome

search
web_browser
chrome

#1

###MACRO:   [SEARCH] OPEN URL or Search Using Google Chrome

~~~ VER: 2.1    2016-09-19 ~~~

####DOWNLOAD:
[SEARCH] OPEN URL or Search Using Google Chrome.kmmacros (23 KB)

I have been using this macro (or earlier versions of it) many times a day for nearly a year now. I has been one of the greatest time-savers I use.


###ReleaseNotes

Author: @JMichaelTX

PURPOSE:

  • Using Selection, or Remainder of Paragraph if No Selection
    • IF Web URL,          Open the Web Page in Google Chrome
    • IF Non-Web URL,  Open URL in Default Provider
    • IF NOT an URL,     Search using Google Search in Chrome

TRIGGER: I suggest ^⇧G

HOW TO USE:

  1. Choosing Text to Use. EITHER:
  • Select text to search for, or URL to Open
         OR
  • Place cursor at START of text (will be auto-selected from cursor to end of paragraph)
  1. Run this Macro.

USER SETTINGS:

  • Any Action in magenta color is designed to be changed by end-user
  • This macro uses Google Search and Google Chrome, but can be easily changed

ACTION COLOR CODES

  • To facilitate the reading, customizing, and maintenance of this macro,
    key Actions are colored as follows:
  • GREEN – Key Comments designed to highlight main sections of macro
  • MAGENTA – Actions designed to be customized by user
  • YELLOW – Primary Actions (usually the main purpose of the macro)
  • ORANGE – Actions that permanently destroy Varibles or Clipboards
By downloading or installing this software, you agree to the terms of usage in the below Action labeled "License and Usage Agreement".  
DO NOT INSTALL OR USE IF YOU DO NOT AGREE.


Best Macros by @JMichaelTX
Best Macro List
Set variable with selected text and append to defined search URL
Using and Comparing Automation Tools: Keyboard Maestro, Alfred, LaunchBar, etc
#2

Below is the script required for the last Action:

tell application "Keyboard Maestro Engine"
  
  --- DELETE ALL KM VARIABLES WITH THIS PREFIX ---
  
  set prefixStr to getvariable "KMVarPrefix"
  
  if (prefixStr ≠ "") then
    set value of variables whose name starts with prefixStr to "%Delete%"
    --    display notification "All KM Variables with PREFIX = '" & prefixStr & ¬
    --      "' have been deleted." with title "Keyboard Maestro Script"
  end if
  
  --- DELETE KM VARS IN THE VARIABLE "KMVars_To_Delete" ---
  
  set varsToDeleteList to paragraphs of (getvariable "KMVars_To_Delete")
  
  if (varsToDeleteList ≠ {}) then
    
    set varsToDeleteList to varsToDeleteList & {"KMVars_To_Delete"}
    
    repeat with oVar in varsToDeleteList
      setvariable (oVar as text) to "%Delete%"
    end repeat
    
    ##    display notification "All KM Variables in 'KMVars_To_Delete' have been deleted." with title "Keyboard Maestro Script"
    
  end if
  
end tell

My apologies for failing to provide this as part of the Macro.