Grid mode toggle
By Thomas Gloor @Thomas_Gloor
As requested by @samuel_henriques here's a repost of my question about Grid Mode Toggle script
I have a toggle command to flip between SLIP and ABS GRID mode but it fails when the grid is in REL GRID.
var grid = sf.ui.proTools.mainWindow.groups.whoseTitle.is("Edit Mode Cluster").first.buttons.whoseTitle.is("Absolute Grid mode").first;
var relgrid = sf.ui.proTools.mainWindow.groups.whoseTitle.is("Edit Mode Cluster").first.buttons.whoseTitle.is("Relative Grid mode").first;
var slip = sf.ui.proTools.mainWindow.groups.whoseTitle.is("Edit Mode Cluster").first.buttons.whoseTitle.is("EditModeSlip").first;
if(grid.value.invalidate().value === "Selected") {
slip.elementClick();
} else {
grid.elementClick()
}
Does someone have a variant of your EDIT TOOL TOGGLE for this? That would not fail but just stay in rel grid, or even better, switch to abs grid and move on?
Best,
T.
- samuel henriques @samuel_henriques
Hey Thomas,
thank you for that.Here's what I come up just now, let me know if it works.
It should select slip when it's not selected, and if it is, select grid. And if grid is relative, change to Absolute.
//Activate Pro Tools sf.ui.proTools.appActivate(); // Get edit mode cluster btn elements const { shuffleModeButton, spotModeButton, slipModeButton, gridModeButton } = sf.ui.proTools.mainWindow.editModeCluster // If slip is selected if (slipModeButton.value.invalidate().value === "Selected") { // select grid gridModeButton.elementClick() // If grid is not absolute if (gridModeButton.title.invalidate().value != "Absolute Grid mode") { // Click grid btn to change gridModeButton.elementClick() } // Else if slip is not selected, select slip } else if (slipModeButton.value.invalidate().value != "Selected") { // Select slip slipModeButton.elementClick() }
- TThomas Gloor @Thomas_Gloor
Thank you so much!
Am I right to think that if I just want to toggle between SLIP and the current Grid Mode, I should just remove this part?
// If grid is not absolute if (gridModeButton.title.invalidate().value != "Absolute Grid mode") { // Click grid btn to change gridModeButton.elementClick() }
- samuel henriques @samuel_henriques
Yes, that's correct.