Help With URL Not Showing

This macro should take the text and do a query online with google and open the result in a new tab and bring focus to it. Here it is :

This however doesn't work, it doesn't open anything and I am not quite sure why.

Thank you for any help.

Here are the key Actions I use in a similar macro:

If the URL to Open URL is malformed, then it will not work.

Which means your macro ill probably work if you copy a single word, but if you copy more than that, or any strange characters, the URL will contain a space or whatever and thus be invalid and the action will fail.

As @JMichaelTX shows, you need to filter the clipboard to encode it for use in a URL field.

1 Like

The thing is that, it doesn’t even work on single words. It doesn’t trigger the action.

The “{lang}” also looks bogus, probably that is some sort of placeholder and should just be “en”.

Yeah, I just changed it. It still doesn't work. If I copy the url myself into url and replace current clipboard with string of my own, it does work.

I only selected one word from my editor so it should work.

Will try to encode it as Michael does and see if that fixes it.

Post the actual macro, it could be a single bogus character, it’s very hard to debug this way.

I can’t seem to find ‘encode’ action. It doesn’t show up in search and I couldn’t find it in the menu choices.

Here it is,
Keyboard Maestro “search google for selected text” Macro

search google for selected text.kmmacros (20 KB)

You can test it yourself by opening terminal and running vim and selecting something in visual mode.

I even tried to put a pause on it. Doesn't work either way. I really wish I could get this to work.

Thank you so much for any help.

I don't know what's going on, but the macro you posted does not match the image. The macro includes extra characters "Clipboard%" in the URL.

With them removed, the macro works with single word clipboards.

Use the Filter Clipboard action to percent encode the clipboard - I think @JMichaelTX is using a Plug In action for that.

Keyboard Maestro Actions.kmactions (1.0 KB)

You have limited the macro group to iTerm. So, it won’t work in Terminal at all.

It works flawlessly in iTerm for me (with single words).

Yeah sorry, I just assumed not all have iTerm. But how did you make it work? It really doesn't work for me and the reason I suppose is because Current Clipboard does not expand. I have tried to expand as notification to test :

And that doesn't expand.

I am really confused why this doesn’t work. I think the macro should be correct. I removed the trailing clipboard%.

The strange thing is that it worked I think one time, the first time I tried and then it stopped. :frowning:

Here is a screencast :

If I can get this and dash macros working, my life will be complete.

You are right, also for me it just worked 1 time. Probably because I was not in Vim when I first tried it.

I guess the problem is that Vim does not yank to the system clipboard by default.

It yanks it with this line :

If you put in your vimrc.

Maybe you have it in the wrong vimrc? Does it work with MacVim?

When yanking with "*y it goes to the system clipboard.

It copies text correctly. The problem is with the web macro not working I think :

I can just yank with y if I have that line in vimrc, you can see my screencast above.

Sorry, when I replace the “Simulate Keystroke Y” action with this, it works: