Sometimes you just need to see the code of things.
NOTE: This macro can easily be adapted for TextWrangler by changing “BBEdit” to “TextWrangler” in the Execute an AppleScript action, and it would only take a few different changes to support other text editors.
I've not tried Chris' macro with an action or multiple macros, but it has consistently failed to copy any selected single macro to the clipboard. I'll test with an action.
Your macro successfully adds the XML of the selected macro to my targeted Named Clipboard! If possible, I'd like to have it get the XML of any macro that I provide the name for so I don't need to have the macro previously selected.
Download and install both macros and then enable them both. You might also want to assign a hot key trigger to the test macro. After that, edit the test macro and insert the name of the macro whose XML you want to retrieve. Then run the test macro and it will display either the XML of the macro you specified in a window or a blank window if the macro doesn't exist (maybe you mis-spelled its name).
You can get more sophisticated by sending the output of the subroutine to the clipboard or elsewhere and you could use a Prompt for User Input action to ask the the name of the macro to plug into the subroutine.
I played around with your original macro to get what I needed. I needed to get the XML in the background and without any user interaction and came up with the action below.
I have a couple of macros with the same words in the name and didn't want to have trouble using "name contains...". I now see from your new example macro that you've provided that I could have used "name ="