Can I Open Expand Variable in Open URL Action?

I have this macro :

I will have a link in my clipboard and I wish to open it in my browser. However it seems that I can't expand Current Clipobard in there. What can I do to get around that?

Thank you for any help.

This works :

But still its quite strange I can't expand a variable in Open URL action.

It seems to work as expected for me. Have you tried the new %SystemClipboard% token instead of %CurrentClipboard%?

It should work fine as long as the clipboard contains a valid URL.

It is orange because the clipboard does not currently contain a URL.

Keyboard Maestro color codes are generally:

  • Red: This will not work
  • Orange: This would not work right now, but might work is something external changes.

So, for example, a calculation like " 1 + * & 4 " will show in red - nothing you do will make that work. A calculation like “Some Weird Variable Name + 4” will show in orange. It wont work currently, but if you defined “Some Weird Variable Name” to some number, then all would be well.


It is still failing for me.

It seems KM does not expand the Keyword.

SystemClipboard will have some string inside and I want to search for that string on Godoc website. But KM does not expand the variable :

I also tried with CurrentClipboard. Doesn't work too. :disappointed:

I can confirm %SystemClipboard% does not work in the Open URL Action,
but, %CurrentClipboard% does work for me.

Try a simple action like with, with a full URL on the Clipboard:

I strongly suspect that the reason the action is failing is because at the time you execute it, the clipboard contains text that is not properly formatted as a URL.

If you are going to do this test, make sure the clipboard has a single alphabetic word copied.

Because if you copy "two words" or "%SystemClipboard%" or pretty much any other real world text, the URL will be invalid.

Good point, Peter.


Before you use what's on the clipboard, you need to Percent Encode it.
I have a similar Macro that does this, AFTER setting a variable to the clipboard:

It works flawlessly.

@JMichaelTX I have tried your solution and couldn't make the front browser to open the url. Here is my full macro:

Most likely it is not a valid URL.
Display in Window the URL before you try to open it.
If you can't resolve it, post the URL here.

Here it is the modified macro. Opens_A_Random_Url_From_A_File.kmmacros (3.3 KB)

I added the Display Text action. It displays the same url all the time.

The file Je.txt contains the three following urls:

I successfully created a macro with only a New Front Browser Tab with URL “” action triggered by a keyboard shortcut. When triggered, the url is successfully opened in the front browser.

In your Display Text action, the SGCURL variable has a double underscore in it while in the Set Variable action above it the SGCURL variable has only a single underscore in it. That means you have two different variables which might explain the problem. Same problem with your SGCSEARCHTEXT variable.

1 Like

After a few trial, I realised it was easier than I thought and ended with this macro:

In my case I had to drop down to shell script for a opening a url from a variable:

I couldn't get the Open action to work, I also tried with %Variable%OpenURL%.

Hey Felipe,

You should always use the full variable format: %Variable%OpenURL% – otherwise it can be difficult to decipher what is a variable and what is a text-token.

It also helps if you use the correct action for the job:

Open a URL:


You used an Open a File Folder or Application action.


It's an easy mistake to make.


1 Like

Thank you for that, it is something I always wondered about.


Hopefully next time I'll pick the correct one.

1 Like