Use the text selected by Google Search in the current browser

Open a new tab in the current browser and use Google to search for the selected text.
Open a new tab in the current browser and use badu to search for the selected text.
Open a new tab and use the selected url

The above functions are called by shortcut keys.

arc Macros.kmmacros (9.5 KB)

Code example

tell application "System Events"
	set appName to name of first application process whose frontmost is true
end tell

set scriptSource to "
tell application \"" & appName & "\"
	activate
	tell front window
		set clipboardContent to (the clipboard as text)
		set modifiedText to \"https://www.google.com/search?q=\" & clipboardContent
		set newTab to make new tab with properties {URL:modifiedText}
	end tell
end tell
"

run script scriptSource