KM Workflow with Selected Text Input

Hi All!

I’m just starting to dive into everything that KM can do and I’m LOVING IT. I’m not a coder by any means, but I have some knowledge. I’m trying to run the workflow “Copy Markdown as RTF” from here that is installed as a service on my mac. When I try to run the macro with a keyboard shortcut within KM after highlighting the required text, it doesn’t bring the selected text into the workflow. However, if I instead simply set the keyboard shortcut via System Preferences > Keyboard > Shortcuts, it works just fine. I’d rather set it in KM so that way I can sync it to my other computers easily.

I’ve tried copying the selected text to clipboard and setting that to a variable, but I think I’m just super lost. I’ve tried also just using the Run Workflow action, but that didn’t work on its own.

So my main question is essentially, how do I pass the selected text to the workflow? Any and all help on this would be amazing! I’m sure it’s a very simple solution that I just for the life of me cannot figure out! Thanks!

When you run a text service using the Services menu, the system extracts the text and feeds it to the service.

If you manually run the workflow, the text from the selection will not be extracted.

You could install the workflow, and configure the shortcut in the system preference, and then have the macro type the shortcut, but that will not sync as you desire. Its probably still the best option.

In Keyboard Maestro, the only way to get the text is to copy it to the clipboard first - Keyboard Maestro cannot access the selection, only the system can do that and its not exposed in general (you can do it in some applications via AppleScript, but not generally.

After that you should be able to adjust the workflow to receive the system clipboard instead of the selection.