+ Reply to Thread
Results 1 to 8 of 8

Thread: Macro to enable/disable Bartender bars?

  1. #1
    Join Date
    Aug 2009
    Posts
    145

    Macro to enable/disable Bartender bars?

    Hi everyone,

    I'm wondering if it's possible to create a macro that would show or hide a particular bar from Bartender. I'd like to have an additional bar that has all the commonly used daily quest items on it, but not have it showing all the time. I know I could have it set to auto-hide, but for some reason having it flash up when I don't want it to feels... odd.

    Thanks in advance!

  2. #2
    Join Date
    Nov 2009
    Location
    WI, USA
    Posts
    2,614
    Yes... it's possible.


    Though I'm not entirely sure what you are trying to accomplish. If you have quest tracking enabled the items will be attached to their particular quest (most of the time). If you want to use an action bar for the quest item, it's because you want a key bound to it, wouldn't that be better accomplished by action bar paging rather instead then? If you are using a separate un-keybound bar for these items and clicking on them to use them, how is that any different than using the quest tracker buttons for them? Also could be accomplished by simply having an action bar that is hidden unless you hover over it and stick it off on the side someplace.
    "In anything, if you want to go from just a beginner to a pro, you need a montage." /w TankSpot WTB Montage for Raiders.

  3. #3
    Join Date
    Jul 2009
    Posts
    373
    Just create the bar, and then go into its Visibility settings, and check Fade Out, also make sure that the Fade Out Alpha is at 0%, now the bar wont appear until you mouse over it.

  4. #4
    Join Date
    Oct 2010
    Posts
    1

    Manipulating the Bartender4 code to Enable/Disable actionbars in a macro

    In case anybody was wondering, you can expose this ability in Bartender4 by removing a local declaration from the ActionBars.lua file.

    Code:
    local BT4ActionBars = Bartender4:NewModule("ActionBars", "AceEvent-3.0")
    becomes

    Code:
    BT4ActionBars = Bartender4:NewModule("ActionBars", "AceEvent-3.0")
    Doing this makes BT4ActionBars a global variable instead of a local one. In your macro you can then use,

    Code:
    /script BT4ActionBars:EnableBar( id ) 
    
    /script BT4ActionBars:DisableBar( id )
    where "id" is the Bartender4 actionbar number you are trying to show or hide.

    I personally use this for a handmade mount macro. I stick the first two helper macros on actionbar 10, where one will call my random ground mounts and the other calls my random flying mounts. Now I have my main macro that will call a random ground mount on left-click or a random flying mount on right-click using /click. Without any code modification disabling the actionbar will still allow you to call /click on a button on that bar, however, once you logout and back in you can no longer do so. That's where the modified Bartender4 code comes in.

    Here's what the final product macro looks like:

    Code:
    /script BT4ActionBars:EnableBar(10)
    /script BT4ActionBars:DisableBar(10)
    /click [button:1] BT4Button109; [button:2] BT4Button110
    I apologize for the necro, although I do hope this information helps somebody looking for the same thing I was before I decided to check the code.
    Last edited by RVCA18; 10-14-2010 at 03:55 AM.

  5. #5
    Join Date
    Aug 2011
    Posts
    2
    The way I did it makes it unnecessary to change any files within Bartender.

    This creates a toggle for all the extra bars that I don't need to see at all times. It could all put into one macro but because I'm toggling so many bars at once, it exceeds the character limit for normal macros. To solve this I created my first AddOn. It's actually easier than it sounds.

    I created a folder in my AddOns folder called "nBars". In this folder are two files: "nBars.lua" and "nBars.toc". Code for each is below.

    Code:
    --nBars.lua
    SLASH_TOGGLEBARS1 = '/togglebars';
    local function toggler()
    if (BT4Bar10:IsVisible()) then
            BT4Bar10:Hide()
            BT4Bar9:Hide()
            BT4Bar8:Hide()
            BT4Bar7:Hide()
            BT4Bar6:Hide()
            BT4Bar5:Hide()
            BT4Bar4:Hide()
            BT4Bar3:Hide()
        else
            BT4Bar10:Show()
            BT4Bar9:Show()
            BT4Bar8:Show()
            BT4Bar7:Show()
            BT4Bar6:Show()
            BT4Bar5:Show()
            BT4Bar4:Show()
            BT4Bar3:Show()
        end
    end
    SlashCmdList["TOGGLEBARS"] = toggler;

    Code:
    --nBars.toc
    ## Interface: 40000
    ## Title: |cffCC3333 n|nBars
    
    nBars.lua
    Enable the nBars addon when you load WoW, then create a macro for "/togglebars". Stick that macro on your action bar somewhere and assign it a hotkey. I use SHIFT + B.

  6. #6
    Join Date
    Nov 2011
    Posts
    2
    I'm attempting this but when I use my toggle, only bar 10 is hidden. Shouldn't this toggle all the listed bars?

  7. #7
    Join Date
    Aug 2011
    Posts
    2
    Ahh yes, I forgot to add that the bars you want hidden need to have their "visible" attribute unchecked within bartender's settings.

    You can adjust the code I supplied to show/hide as many bars as you wish, but the bars in the code must have their corresponding "visible" attribute unchecked.

    I'm fairly certain that's the issue. I'll have to double check when I get home tonight. Will let you know if it's different.

    This code basically operates using the state of BTBar10. If it's visible hide it and all the rest listed. If it's hidden, show it and all the rest listed. It's not a perfect solution but it's handy.

  8. #8
    Join Date
    Nov 2011
    Posts
    2
    Yep, I can confirm this was the issue. Thanks a ton for the help, been trying to find something like this for quite awhile!

+ Reply to Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts