Moving Audiosuite Plugin position on screen
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
- Christian Scheuer @chrscheuer2019-10-24 22:39:24.343Z
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)?
Dustin Harris @Dustin_Harris
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!
DustinChristian Scheuer @chrscheuer2019-10-24 22:43:55.521Z
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, } });
Dustin Harris @Dustin_Harris
Unfortunately that doesn't work when the referenced position is offscreen :)
Christian Scheuer @chrscheuer2019-10-24 22:50:25.492Z
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 } });
Dustin Harris @Dustin_Harris
Oh wow that's an even better solution! I'll integrate it and post the final result :)