Macro fails with a certain URL

Hi guys, I have this simple macro that opens all the lines in the clipboard as URLs.

It works fine with, e.g., But (I think just recently—maybe since Sierra?) it has been failing with addresses like this one:–14&version=NIV&interface=print

What am I doing wrong?


For Each.kmactions (1.5 KB)

There is an En Dash (U+2013) in your URL (between 2018.1 and 14). Replace it with a hyphen (U+002D) and it should work:

How the hell did you notice that?!?

Good eyes? LOL

Dan, an En Dash is longer than a hyphen :wink:

Yeah, by about 1 pixel. :slight_smile:

Depends on the font…

On my computer, that is literally 1 pixel.

I’m doing text and layout for almost 20 years, and I hate it when authors use hyphens instead of dashes… So maybe I have an eye for that 1 pixel :wink:


I knew it had to be something like that. That’s why I asked. :slight_smile:

Besides that, I’m wearing my glasses today :blush:


Sorry, Tom. That's not you, but I couldn't resist. :smiling_imp:

Wow, impressive. Thanks!

As a guy who also does layout … I’m not thrilled about the idea of having to use hyphens where dashes should go! :laughing:

1 Like

You do not have to use hyphens in you URL, but you will probably need to encode them. The code for an En Dash is “%E2%80%93”, and you will need to ensure you turn off processing of the text tokens in the Open URL action as well.

Keyboard Maestro’s Open URL, uses the system NSURL to parse the URL, and it is very unforgiving - the URL must be well formatted or it simply fails outright.

There is probably a service on the web somewhere that validates a URL, and that would be a very useful resource for this sort of issue. If anyone finds one, I’d be happy to hear - I couldn’t find any service that failed that URL (except NSURL apparently!).

1 Like

That’s a very useful hint. Thanks.

Seems like adding a step to “Encode HTML Entities” works, too, even though that turns the dash into –.

Probably for reasons of Visual Spoofing you can’t use the different dashes (hyphen, En, Em) to distinguish addresses. Even with en Em Dash your URL always leads to Matthew 18:1-14

So I think it doesn’t matter much if you replace the En Dashes with hyphens, or if you encode them, as long as KM’s URL action is happy.

BTW, in the heading of the webpage article itself, there is a hyphen in “Matthew 18:1-14”. Should probably be an En Dash :wink: