Switch statement that operates on Application?

I have a macro to get: URL and Title/FileName from the current application:
CleanShot 2024-06-13 at 15.37.51

As I attempt to expand the list of apps, I support: Obsidian and OmniFocus, I find myself wanting a switch statement. It doesn't look like the switch statement supports "application" as a type. (I can see why). My next thought was if() {} elseif () {} elseif () {} else {}. Effectively a poor man's switch statement. However I can't find elseif. What is the most elegant/tidy way to achieve this?

Forgive me if this is already been asked - searching for: Switch statement on Applications - finds lots of things about the app switcher.

You can use the application related tokens to help you create a Switch statement. See the KM wiki token:Application Tokens [Keyboard Maestro Wiki]

So for example, %Application%1% gives the name of the front application. If you use that to switch on you can achieve what you're after. Perhaps like this:

image

2 Likes

FWIW I've added draft support for copying MD links from GoodLinks to:

1 Like