ConsolePort / Addon Toggle Macro

I had trouble finding a modern toggle macro for addons - the following works and I wanted it to be searchable for posterity.

I find this useful for ConsolePort, when I accidentally forget to toggle it on when on my couch and I want to toggle it back on with one button on my controller!

/run local t={"ConsolePort"}for i=1,#t do if C_AddOns.IsAddOnLoaded(t[i]) then C_AddOns.DisableAddOn(t[i],UnitName("player")) else C_AddOns.EnableAddOn(t[i],UnitName("player")) end end C_UI.Reload()

Notes:

  • You need to replace the example addon name ConsolePort in the code with your own addon name. Be sure not to remove the quotations or any other surrounding code.
  • Make sure to use the addon identifier (e.g. “ConsolePort”) not the display name for users (e.g. “Console Port” with a space). When hovering over an addon in the addon menu in-game, the former appears as a subtitle underneath the display name. Sometimes they’re the same.
  • If you want to check multiple addons, you should be able to add them with commas (e.g. t={“ConsolePort”, “BugSack”}.

The double quotes in the code script have been messed up by the forum and should be replaced with actual double quotes:

"…"

The table list for extra addons needs quotes around each addon:

e.g. t={"ConsolePort", "BugSack", }

2 Likes

Edited thank you!

Does the addon list need the trailing comma you’ve added to function, to clarify?

e.g. t={"ConsolePort", "BugSack", }

The trailing comma is not needed, I just add it because I often forget if I quickly go back and add something later :wink:

2 Likes

Gotcha, thanks for clarifying - I won’t add the comma to the suggestions then. Appreciate that’s part of your flow :slight_smile:

And I just tested your list syntax and can confirm it works in-game (which I should have done in the first place). Thanks again!

1 Like