How to get a keystroke systemwide to trigger an action on text in a selected item, whether file, mail message, selected text, etc.

automatormarkdown

In this question I asked how to create a window containing a html rendered preview of text formatted with Markdown. I would also like to be able to have a single keystroke that systemwide will produce these results. I am thinking an Automator service might be the best approach, but it might not be.
I want to be able to select either text or files as input, and pass either the selected text OR the text contained in the file through the Markdown filter and display the resulting HTML in some sort of preview window.

Any pointers? If it can be a single service, great; if not, a service that runs when the Finder is active that accepts files and a separate service that accepts selected text that runs when any other program is active could work.

I'm not looking for the general case here; it's a core feature on the Mac to use the Keyboard Shortcuts pane in System Preferences to assign a global shortcut to an Automator-generated service. I'm looking for a way for a single keystroke to generate a preview of Markdown-rendered text whether it's a selected text file in the Finder or selected text in another program. Spacebar combined with Quicklook could work in Finder and Command-Option-Shift-M could work for selected text, but I a way for one keystroke to serve the function of "Preview Markdown Results" in any context, whether it's text, a file, a selected mail message, etc. Get the text from the selected item, render it, and display it in a window.

Best Answer

My solution to mapping keyboard shortcuts to arbitrary services (as well as general workflows, application launches and scripts) is FastScripts.

Try it for free and pay if you feel you can or need more than 10 shortcuts to be active at the same time.