Is there a KM Token or Variable which contains the link to (the URL of) the currently selected email in Apple Mail?

thanks in advance for your time and help

No.

But I suspect your question is actually "I can drag an email from Mail to application X and get a clickable link. How do I do that with a KM macro?"

The last part will depend on what application X is, among other things. But for the clickable link:

Make MessageLink.kmmacros (3.7 KB)

Summary

If you select a message in Mail's message viewer and run the above you'll get a "Display Text" window. Copy the text and paste it into Notes and you'll see it's a clickable link to the original email. Exactly what else you need to do (and whether it'll work!) will depend on application X.

What I would do is:

  • Select an item in Mail
  • hit ⌥⌘M

as defined in this macro:
Copy as Markdown Link - Macro Library - Keyboard Maestro Discourse

which will copy a Markdown style labelled link to the clipboard in the pattern:

[selected Mail item title]( clickable link to selected Mail item )

2 Likes

thanks very much for the detailed response and macro.
I put the macro in my Mail palette → selected email → ran the macro → spinning wheel for a while → error messsage

KM Engine Log below

2022-06-24 08:23:06 Execute macro “Make MessageLink” from trigger Macro Set Palette
2022-06-24 08:23:07 Action 9641374 failed: Execute an AppleScript failed with script error: text-script:93:99: execution error: Can’t get item 1 of missing value. (-1728)
2022-06-24 08:23:07 Execute an AppleScript failed with script error: text-script:93:99: execution error: Can’t get item 1 of missing value. (-1728). Macro “Make MessageLink” cancelled (while executing Execute AppleScript).

Which macOS version are we looking at ?

The latest version of the Copy as MD Link macro group is kept at:

RobTrew/copy-as-md-link: macOS Keyboard Maestro macro group – single keystroke to copy MD links from different applications.

but here is a zip of the current version (working here on macOS 11.6.7)

(Note, you need the whole macro group)

MD Link tools Macros.kmmacros.zip (51.8 KB)

1 Like

Catalina, latest version. thanks very much for the referencees

That probably means you had no message selected in Mail's message viewer, or you had more than one message viewer open and we're looking in the wrong one for a selected message.

Either way -- ignore it. Mine was just a quickly knocked up suggestion of how you could do it. @ComplexPoint's macro is much, much better and will probably be ready to go with whatever your target app is. Delete mine, install his, and be instantly more productive!

WOW !! fantastic macro. Thank you so much. Compatible with so many apps. Works like a charm. Easy to install thanks to your post.

1 Like

Yes, after testing, I tend to prefer @ComplexPoint 's macro. I remain very grateful for all your work and insight.