No internet connection
  1. Home
  2. How to

Exclude Greyed out options from a pop up menu in popup search

By Mitch Willard @Mitch_Willard
    2023-05-27 05:53:27.156Z2023-05-27 07:59:28.649Z

    Hi all,

    Is there a way to exclude items that are greyed out in a popup menu so that only those that are available will fill the popup search menu?

    Specifically trying for this particular code getting the items of all the options in the TC/E section in the preferences window, but only show the available items in the popup search.

    let tceToolOptions = sf.ui.proTools.windows.whoseTitle.is("Pro Tools Preferences").first.groups.whoseTitle.is("TC/E").first.popupButtons.first.popupMenuFetchAllItems().menuItems
    
    var selectedTCETool = sf.interaction.popupSearch({
        title: 'Please Select Backup to Restore from..',
        items: tceToolOptions.reverse().map(x => ({
            name: x.names.slice(-1)[0],
        })),
        columns: [{ name: 'Please Select TC/E Tool..', key: 'name', width: 100 }]
    }).item.name
    
    

    cheers

    Solved in post #2, click to view
    • 2 replies
    1. @Mitch_Willard, you could do it by filtering the menu items like this:

      let tceToolOptions = sf.ui.proTools.windows.whoseTitle.is("Pro Tools Preferences").first
          .groups.whoseTitle.is("TC/E").first
          .popupButtons.first.popupMenuFetchAllItems().menuItems
          .filter(mi => mi.element.isEnabled);
      
      ReplySolution
      1. Mitch Willard @Mitch_Willard
          2023-05-28 03:23:43.291Z

          Amazing, thanks @raphaelsepulveda. Figured it would be something like this.
          Cheers for the help.