Strange Problem with kmtrigger://

@peternlewis I'm tagging you because I suspect this might not be a KM issue, but rather a System issue, but only you would know for sure.

I've been trying to track down an issue, which turned out to be my problem. However I don't understand the results.

Here's as simplified an example has I can come up with right now.

I have a link in the StyledText portion of a Comment, that's supposed to run one of my macros with a parameter. The link looks like this (sort-of - more info below):

kmtrigger://macro=CF61922A-85A6-4DEE-A4C4-1548E5168FDB&value=%Variable%DND__ORPath%/Comment.15851100.rtf

Here's the "value" portion for clarity:

%Variable%DND__ORPath%/Comment.15851100.rtf

NOTE: I'm actually passing the text %Variable%DND__ORPath%, NOT the contents of that variable.

This is where I made my mistake. I should have percent-encoded it like this, which I already knew but forgot to do this time:

%25Variable%25DND%5F%5FORPath%2FComment%2E15851100%2Ertf

Here's my question: When I click on the un-encoded link, my macro never gets executed and I get no errors. I put a test Prompt action at the very top of the linked-to macro, and it never gets there.

Do you know why this happens? I'd like to test for this condition, but I can't do any testing if clicking on the link doesn't take me to the macro.

I hope this makes sense. I'm so "deep" into my code that it wouldn't surprise me if I left something out, or made this overly complicated.

Thanks.

If the URL is invalid, then the system NSURL will simply fail. So if the URL is invalid, then it may be that is exactly what is happening, you click on it, the system tries to parse the URL, then decides it is invalid, and then that's the end of that.

A quick look at the code on the Keyboard Maestro Engine receiving side looks like it is all strings, not parsed as URLs, so it should be fine - if it got to Keyboard Maestro.

1 Like

That was what I suspected, but thank you for confirming it,

1 Like