No internet connection
  1. Home
  2. Macro and Script Help

How to "Close All Floating Windows", except the automation window and by using the same keycommand, re-open the floating windows

By Thomas Staugaard @Thomas_Staugaard
    2022-09-29 10:36:14.934Z

    Title

    How to "Close All Floating Windows", except the automation window and by using the same keycommand, re-open the floating windows

    What do you expect to happen when you run the script/macro?

    Hello.

    I was wondering if this script can make the windows re-open again, by pushing the same command key? Like a toggle function.

    My goal is to close all floating windows, except the automation window, and by pushing the same button, re-open the floating windows.

    The closest i can get is to use the key command: "Close All Floating Windows", but it also closes the automation window, but it is very cool, that i can re-open the windows by pushing the same button.

    So, is it possible to make all floating windows close, except the automation window and by pushing the same button, re-open the floating windows again?

    Kind regards
    Thomas

    Are you seeing an error?

    What happens when you run this script?

    How were you running this script?

    Other

    How important is this issue to you?

    3

    Details

    {
        "inputExpected": "Hello.\n\nI was wondering if this script can make the windows re-open again, by pushing the same command key? Like a toggle function.\n\nMy goal is to close all floating windows, except the automation window, and by pushing the same button, re-open the floating windows.\n\nThe closest i can get is to use the key command: \"Close All Floating Windows\", but it also closes the automation window, but it is very cool, that i can re-open the windows by pushing the same button. \n\nSo, is it possible to make all floating windows close, except the automation window and by pushing the same button, re-open the floating windows again?\n\nKind regards\nThomas ",
        "inputIsError": false,
        "inputHowRun": {
            "key": "-MpfwoFyZNOpBC3X5xGI",
            "title": "Other"
        },
        "inputImportance": 3,
        "inputTitle": "How to \"Close All Floating Windows\", except the automation window and by using the same keycommand, re-open the floating windows"
    }

    Source

    sf.ui.proTools.viewCloseTempFloatingWindows();
    
    

    Links

    User UID: 5TP0a8EDw2dQiajMX5GxcFPB4Vi2

    Feedback Key: sffeedback:5TP0a8EDw2dQiajMX5GxcFPB4Vi2:-ND7oN1bxdQLotuI_HfB

    Feedback ZIP

    Solved in post #2, click to view
    • 2 replies
    1. Chris Shaw @Chris_Shaw2022-09-30 22:36:06.157Z2022-09-30 22:48:40.428Z

      Try this:

      This uses a window configuration in the window configurations list in slot 97.
      If you want to use a different location then change 97 to whatever value you like in line 19, 14, and 46.

      sf.ui.proTools.appActivateMainWindow();
      
      if (sf.ui.proTools.floatingWindows.length > 1) {
      
          // Open "New Configuration" window
          sf.ui.proTools.menuClick({
              menuPath: ["Window", "Configurations", "New Configuration..."]
          });
      
          const newConfigWin = sf.ui.proTools.windows.whoseTitle.is("New Window Configuration").first
      
          newConfigWin.elementWaitFor({ waitType: "Appear" })
      
          //Save window config to location 97
          newConfigWin.textFields.whoseValue.is("(untitled)").first.elementSetTextFieldWithAreaValue({
              value: "Floating Window Save"
          });
          newConfigWin.textFields.first.elementSetTextFieldWithAreaValue({
              value: "97",
              useMouseKeyboard: true
          });
          //Set window config checkboxes
          newConfigWin.radioButtons.whoseTitle.is("Window Layout").first.elementClick()
          newConfigWin.checkBoxes.whoseTitle.contains("Include MIDI Lanes").first.checkboxSet({ targetValue: "Disable" })
      
          //Save and close new window configuration window
          newConfigWin.buttons.whoseTitle.is("OK").first.elementClick();
          newConfigWin.elementWaitFor({ waitType: "Disappear" })
      
          // Check for conf dialog - confirm and dismiss if it appears
          sf.ui.proTools.confirmationDialog.elementWaitFor({
              timeout: 300,
              pollingInterval: 20,
              onError: "Continue"
          })
          if (sf.ui.proTools.confirmationDialog.exists) {
              sf.ui.proTools.confirmationDialog.buttons.whoseTitle.is("OK").first.elementClick()
          };
      
          //Close all floating windows
          sf.ui.proTools.viewCloseFloatingWindows()
      
      } else {
          //If only the automation window is showing, recall window configuration
          sf.ui.proTools.menuClick({
              menuPath: ["Window", "Configurations", "97"],
              looseMatch: true
          });
      };
      
      // Ensure automation window is visible
      sf.ui.proTools.menuClick({
          menuPath: ["Window", "Automation"],
          targetValue: "Enable"
      })
      
      ReplySolution
      1. T
        Thomas Staugaard @Thomas_Staugaard
          2022-10-03 11:35:15.113Z

          Hello, Chris

          This is it, works perfectly

          Thank you! :-)

          /Thomas