Here's 2 scripts to toggle the smart tool to Smart tool with Trim = Time Compression/Expansion - and to select smart tool with normal trim.
Smart tool with TCE:
sf.ui.proTools.appActivateMainWindow();
if (sf.ui.proTools.mainWindow.cursorToolCluster.trimTool.title.invalidate().value.indexOf('Time Compression') < 0) {
sf.ui.proTools.mainWindow.cursorToolCluster.trimTool.popupMenuSelect({ menuPath: ['TCE'], isRightClick: true });
}
sf.ui.proTools.toolsSelect({
tool: 'Smart'
});
Smart tool with normal trim:
sf.ui.proTools.appActivateMainWindow();
if (sf.ui.proTools.mainWindow.cursorToolCluster.trimTool.title.invalidate().value != "Trim tool") {
sf.ui.proTools.mainWindow.cursorToolCluster.trimTool.popupMenuSelect({ menuPath: ['Standard'], isRightClick: true });
}
sf.ui.proTools.toolsSelect({
tool: 'Smart'
});
- JIn reply tochrscheuer⬆:Jon Shamieh @Jon_Shamieh
Perhaps a silly question, but how do I set up a Macro to Toggle between these two?
Christian Scheuer @chrscheuer2019-12-26 21:46:42.039Z
You can't set up a macro to do this since macros don't have if/else logic yet - it has to be a script. You can use Macros and Scripts interchangeably though. Is there a specific reason why you'd prefer this as a macro?
Christian Scheuer @chrscheuer2019-12-26 21:52:38.530Z
Ah gotcha, you just meant a script that can toggle instead of manually selecting either.
You could do that like this:
sf.ui.proTools.appActivateMainWindow(); if (sf.ui.proTools.mainWindow.cursorToolCluster.trimTool.title.invalidate().value.indexOf('Time Compression') < 0) { sf.ui.proTools.mainWindow.cursorToolCluster.trimTool.popupMenuSelect({ menuPath: ['TCE'], isRightClick: true }); } else { sf.ui.proTools.mainWindow.cursorToolCluster.trimTool.popupMenuSelect({ menuPath: ['Standard'], isRightClick: true }); } sf.ui.proTools.toolsSelect({ tool: 'Smart' });
- JJon Shamieh @Jon_Shamieh
Yep, didn't need to be a macro, that did it – thank you!
- In reply tochrscheuer⬆:Dustin Harris @Dustin_Harris
related, and building upon the flat menu items discussion with @chrscheuer and @Kitch here:
https://forum.soundflow.org/-2271/how-to-convert-a-flat-menu-item-into-an-array#post-2I've made two scripts that allow the user to set the trim tool to standard or TCE and checks which state the button is currently in before changing it (saves a bit of time during selection).
Standard:
sf.ui.proTools.appActivateMainWindow(); let menuItems = sf.ui.proTools.mainWindow.cursorToolCluster.trimTool.popupMenuFetchAllItems({ isRightClick: true, }).menuItems; let checkedMenuItem = String(menuItems.filter(m => m.element.isMenuChecked)); sf.ui.proTools.appActivateMainWindow(); if (checkedMenuItem !== "Standard"){ sf.ui.proTools.mainWindow.cursorToolCluster.trimTool.popupMenuSelect({ menuPath: ['Standard'], isRightClick: true }); }
TCE:
sf.ui.proTools.appActivateMainWindow(); let menuItems = sf.ui.proTools.mainWindow.cursorToolCluster.trimTool.popupMenuFetchAllItems({ isRightClick: true, }).menuItems; let checkedMenuItem = String(menuItems.filter(m => m.element.isMenuChecked)); sf.ui.proTools.appActivateMainWindow(); if (checkedMenuItem !== "TCE"){ sf.ui.proTools.mainWindow.cursorToolCluster.trimTool.popupMenuSelect({ menuPath: ['TCE'], isRightClick: true }); }
Cheers!
Kitch Membery @Kitch2020-07-23 21:26:05.203Z
Nice one @Dustin_Harris!
- In reply toDustin_Harris⬆:
Daniel Perez @daniel_perez
is this one improved with the help of the new pt scripting sdk?
Dustin Harris @Dustin_Harris
Heyya Daniel, there is no SDK command yet for changing the selected tool (at least none I could find in the SDK documentation AVID provides) so for the time being, we'll have to make do with what we have :)
-D