Search for Google with text in your clipboard

I'm trying to create a shortcut that will Google search the copied text.
So I created the following macro:

But it failed.
I think what happens is that the contents of the clipboard are put into a box called "SearchText" and then entered into a Google query.
I don't know where I am going wrong...

Pause is not necessary, unless you like the pause.

Filter System Clipboard with Percent Encode for URL

1 Like

You need to "URL Encode" the " -- they're illegal characters in a URL. So you could (remembering that you also have to escape the % because it's a special token in KM):

https://www.google.com/search?q=%%22%SystemClipboard%%%22

But you'll also want to encode your search term, in case that contains illegal characters too. So you might as well do it all in one go then feed the encoded string as the search parameter:

Google Phrase Search.kmmacros (2.1 KB)

1 Like

(FYI, you can filter the clipboard directly, no need to filter 'text' variable clipboard)

1 Like

Spot the added double-quotes -- that's why I've done it this way.

1 Like

Oh gotcha, for an exact phrase search!

1 Like

Hello johns,

Thank you so much for answering, and I'm sorry for late reply.
It solved completely! Thank you for your perfect answer.
And as you said, yes pause is not necessary.
Depending on the content of the macro, it may not work properly unless a pause is inserted, so I have a habit of inserting a pause lol.
But this macro is no problem without pause.
Thank you!!!

1 Like

While this is solved, Iā€™m offering another solution for the microbit of ease that comes with clicking while your hand is already on the mouse or trackpad. And that is to use the PopClip app.

With its interface popping up as soon as you release the drag to select some text you can move the short distance to the search icon, click it and get a Google search of the selected text.

Further, if you like the UI, you can add KM macros to the pop up menu. If you explore this, note that there are hidden settings to lengthen the menu before having to click and reveal a second row which kills the convenience factor which is its chief benefit.

For a few key actions it's hard to beat.