Here's a template for creating macros that allow multi-press hotkeys:
For more information, see the wiki Searching the Forum for Answers section.