Commands are stored in the
SlashCmdList table. You'll need the token the addon uses to register the command.
For example, you can open BigWigs' options window by calling this.
Code:
SlashCmdList.BigWigs()
To send arguments, just pass them as a single string to the function, similar to this.
Code:
SlashCmdList.TOKEN("args")
While you can also access commands using
hash_SlashCmdList, slash commands are often localized, meaning your code probably won't work in other languages.
SlashCmdList is more stable as tokens are not supposed to be localized.
If you insist on using macro buttons, you can inject links using concatenation or formatting. Note this is also susceptible to localization.
For example, this'll make you send the link for
Hearthstone in
/say.
Lua Code:
local frame = CreateFrame("Button", nil, region, "SecureActionButtonTemplate")
frame:SetAllPoints(region)
frame:SetAttribute("type","macro")
frame:SetAttribute("macrotext", "/say " .. select(2, GetItemInfo(6948)))
frame:RegisterForClicks("AnyDown")