Search Google with clipboard

I want to make a macro that would make a search on Google where query will be clipboard.

I made this macro :

test.kmmacros (24 KB)

However, for some reason System Clipboard does not expand and I am not quite sure whether Percent Encoding is correct choice here.

Not really sure why it doesn't expand. :disappointed:

Thank you for any help.

Your macro works fine here.

I think the problem is that you have tested it twice in a row, so the clipboard content (on the 2nd test) has been URL-encoded twice. (You are copying the result of the Filter action back to the clipboard.)

So, feed the clipboard to a variable, filter the variable, and use that variable in the search.

Or, shorter, filter the clipboard directly to a variable, like this:

[test] Web Search.kmmacros (1.9 KB)

2 Likes

This works Thank you @Tom

Strangely it did not work for me on the first time I tried it. Where I freshly selected some text and tried running the macro. I donโ€™t know why.

But your workflow does work. I donโ€™t really see a difference though as mine should work too.

As said, you were copying the result of the clipboard-Filter action back to the clipboard. So, the next time you run the macro (without having refreshed the clipboard) you are percent-encoding the already percent-encoded clipboard.

1 Like

Oh, I think I made some mistake. And yeah you are right it does work. Also the copying into a variable is a better solution. So as using DuckDuckGo. :slight_smile:

Glad to hear that the educational side of my post was not in vain!

I was truly horrified when I had downloaded your macro, clicked the Run button and then saw a Google address in the URL action :cold_sweat:

Fortunately Little Snitch blocked it.

I have tried this script but it doesn't do anything. I have version 9.0.3, is yours still working?