I still don't know exactly what you are doing? Are you trying to recover from limit switches, or E Stop buttons, or both?
To have a Hotkey do something, you need to write a macro to do it, and have the hotkey call the macro.
But if you have a macro activate the relay, how do you de-activate it, and what determines when you de-activate it?
It seems like you're making things more difficult, by trying to make them simpler, if that makes sense.