rowaasr13@0: -- [AUTOLOCAL START] rowaasr13@0: local CreateFrame = CreateFrame rowaasr13@0: local InCombatLockdown = InCombatLockdown rowaasr13@0: local SecureHandlerWrapScript = SecureHandlerWrapScript rowaasr13@0: local print = print rowaasr13@0: local type = type rowaasr13@0: -- [AUTOLOCAL END] rowaasr13@0: rowaasr13@0: local frame_name = "OOCDo" rowaasr13@0: local button = CreateFrame("Button", frame_name, nil, "SecureActionButtonTemplate,SecureHandlerMouseUpDownTemplate") rowaasr13@0: button:SetAttribute("type", "macro") rowaasr13@0: button:SetAttribute("macrotext", "") rowaasr13@0: SecureHandlerWrapScript( rowaasr13@0: button, -- frame rowaasr13@0: "OnClick", -- script rowaasr13@0: button, -- header rowaasr13@6: 'return nil, "reset"', -- pre rowaasr13@6: 'self:SetAttribute("type", "macro") self:SetAttribute("macrotext", "")' -- post rowaasr13@0: ) rowaasr13@0: rowaasr13@7: --- Sets button to perform given macro text as-is. rowaasr13@7: -- Sets button's .type to "macro" and .macrotext to given string verbatim rowaasr13@7: -- @param command macro text to perform rowaasr13@7: -- @param command2 same as command, if first argument is "taken" because of : call. rowaasr13@2: function button.MacroText(command, command2) rowaasr13@0: if command == button then command = command2 end rowaasr13@0: if InCombatLockdown() then return end rowaasr13@7: button:SetAttribute("type", "macro") rowaasr13@0: button:SetAttribute("macrotext", command) rowaasr13@0: end rowaasr13@0: rowaasr13@0: button.Macro = button.MacroText rowaasr13@0: button.T = button.MacroText rowaasr13@0: button.M = button.MacroText