Can I bind a key to a macro without applying it on an action button?
Here is a solution that has been tested. This solution assumes that all the action bars are not in use nor shown. Go in to the Interface menu then set an hidden action bar to show. Next add an action or macro to that bar. Once the action has been added to the bar, go in to the built in Key Binding option menu, find the bar and action-button combo that you just set the action to, then bind the wanted key to that combo. Once finish, go back in to the Interface menu, set the bar to hide then test it out.
If all of the action bars are shown then there is a second solution. However, this solution does requires a addon call Clique. Clique is an addon, which is very popular among players, that allows spells and actions to be binded to keys and mouse-clicks without the use of an action bar. Clique doesn't change the physical UI of the normal view. It only adds another tab to the spell book. Go in to the tab, bind the a action to a key or mouse button and forget about it.
After reading the body of your question again, I believe the first solution is the current solution you use. However, I will not remove that part of the answer as it might help a future user with a similar question.
You can bind a macro to a key without an addon using SetBindingMacro followed by SaveBindings.
/run SetBindingMacro("SHIFT-A", "mymacro")
/run SaveBindings(2)
Replace SHIFT-A
with whatever key you want: A
, ALT-A
, CTRL-SHIFT-A
, etc.
Replace mymacro
with the name you gave your macro.
Replace the 2
in the SaveBindings
call to a 1
if you do not have character specific key bindings. If you are playing Classic rather than Retail, use AttemptToSaveBindings
instead of SaveBindings
.
SetBindingSpell
can be used similarly to bind spells.