No internet connection
  1. Home
  2. Support

Moving Audiosuite Plugin position on screen

By Dustin Harris @Dustin_Harris
    2019-10-24 21:58:16.189Z

    Hi! (Last question today, I promise)
    I want to move an audio suite plugin that I keep offscreen into the middle of the screen with a script. I've figured out how to do it with an app's main screen but not a floating window (like an audio suite plugin) I just don't know the right syntax.
    Is there a way to do it with a variable?

    sf.ui.proTools.appActivateMainWindow();
    
    var asWin = sf.ui.proTools.getAudioSuiteWindow("RX 7 Connect");
        if (!asWin.exists){ 
        log('Please press F13 to open Rx Connect');
        throw 0;
    
        }
    else {}
    
    
    //this code here to move asWin to 'Bottom' or 'Center80'
    
    

    Thanks!
    Dustin

    • 6 replies
    1. This code will move RX 7 Connect to the middle of Screen 1 (screenIndex = 0). Set screenIndex to 1 for screen 2, etc.:

      sf.ui.proTools.appActivateMainWindow();
      
      var asWin = sf.ui.proTools.getAudioSuiteWindow("RX 7 Connect");
      if (!asWin.exists) {
          log('Please press F13 to open Rx Connect');
          throw 0;
      }
      
      //This will center asWin on screen with index 0 - ie. the first screen
      var screenIndex = 0;
      var screenFrame = sf.ui.screens.allScreens[screenIndex].visibleFrame;
      var windowFrame = asWin.frame;
      asWin.windowMove({
          position: {
              x: screenFrame.x + screenFrame.w / 2 - windowFrame.w / 2,
              y: screenFrame.y + screenFrame.h / 2 - windowFrame.h / 2,
           }
      });
      

      Is this because it's nice to have centered or because you think it's necessary to move the window in order to do some other commands with the mouse (hint: that shouldn't be necessary, so if that's the case please let us know the full workflow you're trying to build since there might be a better solution)?

      1. Dustin Harris @Dustin_Harris
          2019-10-24 22:42:17.603Z

          Perceptive! It's for RX7 Connect to select the UI Element 'Reference' / 'Repair' which don't seem to be accessible by normal means (unless you have a way?)

          Thanks again!
          Dustin

          1. Gotcha. Then you don't need to move the plugin at all.
            You'd want to use this instead:

            asWin.mouseClickElement({
                relativePosition: {
                    x: 170,
                    y: 300,
                }
            });
            
            1. Dustin Harris @Dustin_Harris
                2019-10-24 22:48:48.959Z

                Unfortunately that doesn't work when the referenced position is offscreen :)

                1. Aaah I see. Sorry I missed that part.

                  Then if you want, you could move it into the center, click where you want, and then move it back - in one go, like this:

                  
                  sf.ui.proTools.appActivateMainWindow();
                  
                  var asWin = sf.ui.proTools.getAudioSuiteWindow("RX 7 Connect");
                  if (!asWin.exists) {
                      log('Please press F13 to open Rx Connect');
                      throw 0;
                  }
                  
                  //This will center asWin on screen with index 0 - ie. the first screen
                  var screenIndex = 0;
                  var screenFrame = sf.ui.screens.allScreens[screenIndex].visibleFrame;
                  var windowFrame = asWin.frame;
                  asWin.windowMove({
                      position: {
                          x: screenFrame.x + screenFrame.w / 2 - windowFrame.w / 2,
                          y: screenFrame.y + screenFrame.h / 2 - windowFrame.h / 2,
                       }
                  });
                  
                  //Click it
                  asWin.mouseClickElement({
                      relativePosition: {
                          x: 170,
                          y: 300,
                      }
                  });
                  
                  //Move back
                  asWin.windowMove({ position: { x: windowFrame.x, y: windowFrame.y } });
                  
                  1. Dustin Harris @Dustin_Harris
                      2019-10-24 22:52:24.142Z

                      Oh wow that's an even better solution! I'll integrate it and post the final result :)