Using a
SecureActionButtonTemplate, if you set
type to
"macro", you can set a string to
macrotext that'll let you run it as a macro with unlimited length.
https://wow.gamepedia.com/SecureActionButtonTemplate
Example:
Lua Code:
local MacroButton=CreateFrame("Button","MyMacroButton",nil,"SecureActionButtonTemplate");
MacroButton:RegisterForClicks("AnyUp");-- Respond to all buttons
MacroButton:SetAttribute("type","macro");-- Set type to "macro"
MacroButton:SetAttribute("macrotext","/use Hearthstone\n/say Using my Hearthstone.");-- Set our macro text
This creates a button named
MyMacroButton that can be activated by using the
CLICK MyMacroButton binding command.
https://wow.gamepedia.com/Creating_key_bindings
https://wow.gamepedia.com/API_SetBinding