Directory Opus 11 and above have proper scripting support for normal buttons, hotkeys, etc.
There is no longer any reason to abuse the Rename command in order to run scripts. You can simply run scripts directly, which is much better.
This post was obsolete and has been removed, other than keeping this as placeholder for other old threads which link to it. (You can view the edit history if you really want to see the old information.)