No internet connection
  1. Home
  2. Support

Enable / Disable Menu Item instead of Toggle?

By Dustin Harris @Dustin_Harris
    2019-10-24 15:16:36.819Z

    Hi! I know we can use the element click to toggle a menu item, but it's agnostic to whatever state it's in. Is there a way to check a state, or to force enable / disable?

    Pro Tools loop playback as an example:

    sf.ui.proTools.menuClick({
        menuPath: ["Options","Loop Playback"],
    });
    

    Thoughts?

    Solved in post #2, click to view
    • 13 replies
    1. Certainly :)

      sf.ui.proTools.menuClick({
          menuPath: ["Options","Loop Playback"],
          targetValue: 'Disable'  //or 'Enable' or 'Toggle'
      });
      
      Reply1 LikeSolution
      1. And if you just wanted to check:

        if (sf.ui.proTools.getMenuItem('Options', 'Loop Playback').isMenuChecked)
        {
            //Loop Playback is enabled
        }
        else 
        {
            //Loop Playback is not enabled
        }
        
        1. Andrew Scheps @Andrew_Scheps
            2020-04-06 11:45:56.672Z

            Can you do this with a popup menu? I'm trying to add the targetValue parameter to a popup menu select and getting a syntax error.

            Specifically I'm trying to make sure auto-created clips are being displayed in the clip list and the only place to do that is in the clip bin popup menu.

            1. ? I'm trying to add the targetValue parameter to a popup menu select and getting a syntax error.

              How did you write this? You should be able to use targetValue in popupMenuSelect:

              sf.ui.proTools.mainWindow.popupButtons.whoseTitle.is('Clip List').first.popupMenuSelect({    
                  menuPath: ['Show', 'Auto-Created'],
                  targetValue: 'Enable',
              });
              
              1. Andrew Scheps @Andrew_Scheps
                  2020-04-08 12:04:30.033Z

                  That's very strange, I'm sure I had it exactly like that. Working now, thanks!

            2. In reply tochrscheuer:
              Dustin Harris @Dustin_Harris
                2019-10-24 15:19:34.852Z

                Woah, that was easy. :)

              • S
                In reply toDustin_Harris:

                I was surprised to find this isn't included in the regular PT package. Seems like a good one to add, maybe with one of Kitch's beautiful premade buttons :) Would also be nice if this was (I forget the correct SF terminology) one of those buttons that could reflect the state in PT by changing color.

                1. @Kitch can you make the icons for this? Then I can make the scripts. (OPP -> Options menu -> Loop Playback)

                  1. Wow! You guys are the best!

                    1. In reply tochrscheuer:
                      Kitch Membery @Kitch2024-06-08 17:51:34.760Z

                      For sure. Anything for Steve!

                      Will send them to you first thing Monday (or earlier).

                      1. In reply tochrscheuer:
                        Kitch Membery @Kitch2024-06-10 00:47:43.792Z

                        Icons sent :-)

                        1. Update: We might take a bit more time diving into this to make sure we cover all the playback modes

                          1. This is now up in 1.0.34