I'm trying to make a script that selects the Grabber Object Tool and this just selects the standard Grabber:
sf.ui.proTools.toolsSelect({
tool: "Grabber",
});
I also tried finding out via the 'Add Action' in the Macro Editor if I could find any clues, which got me this:
sf.ui.proTools.mainWindow.groups.whoseTitle.is('Cursor Tool Cluster').first.buttons.whoseTitle.is('Grabber tool (Object)').first.elementClick();
However, this fails at "ClickButtonAction requires UIElement (ClickButtonAction)".
I thought I was clever and put (Object) in the first script but it seems only the main Tool names 'Smart', 'Grabber', 'Trim' and 'Selector' are possible to use that way.
Ideas?
- Christian Scheuer @chrscheuer2019-09-27 21:07:30.199Z
This one works for me:
sf.ui.proTools.mainWindow.groups.whoseTitle.is('Cursor Tool Cluster').first.buttons.whoseTitle.startsWith('Grabber tool').first.popupMenuSelect({ isRightClick: true, menuPath: ['Object'] });
Christian Scheuer @chrscheuer2019-09-27 21:10:02.771Z
Explanation:
It uses the same code to get to the grabber tool, but since that tool changes title based on what is selected, I changed it so that it's searching for a button whose title "starts with" "Grabber tool". Then I specify to right click on that element and choose "Object" from the popup menu.
- In reply tochrscheuer⬆:JJohn Rammelt @John_Rammelt
Hi Christian!
Well, it kind of works but in an unexpected way; if I first mouse-click to select the Object Grabber, it also deselects the Smart Tool, which what I was after. I have another script to select the Smart Tool. With this script you gave me now, it selects the Grabber Object Tools BUT still as a Smart Tool. Do I make sense?- JJohn Rammelt @John_Rammelt
It is however working, so I think I'll just adapt to this for now. If I need to, I'll simply make a similar script for 'Time' (and 'Separation').
- In reply toJohn_Rammelt⬆:
Christian Scheuer @chrscheuer2019-09-27 21:23:34.682Z
Hi John :)
You can force it to be non-smart-tool by first left-clicking the grabber tool like this:sf.ui.proTools.mainWindow.groups.whoseTitle.is('Cursor Tool Cluster').first.buttons.whoseTitle.startsWith('Grabber tool').first.elementClick(); sf.ui.proTools.mainWindow.groups.whoseTitle.is('Cursor Tool Cluster').first.buttons.whoseTitle.startsWith('Grabber tool').first.popupMenuSelect({ isRightClick: true, menuPath: ['Object'] });
- JJohn Rammelt @John_Rammelt
Excellent!
- In reply toJohn_Rammelt⬆:Dustin Harris @Dustin_Harris
Hi to build on this, how does one capture the state of a button?
I want to make the selector tool toggle between 'Standard' and 'TCE' (and bypass the selection of 'Scrub' and 'Loop'...
So if I can check the state of the button:EDIT 2 Found the answer in another post. I don't need to check the state, just check for not a current state :)
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 }); }
Thanks!
EDIT: changed selector tool to trim tool.- JJoakim Bjerknes @Joakim_Bjerknes
Hey Dustin, i need a way to togge between Time and Oject for grabber tool, but i cant seem to figure out how to change it from Trim tool
Dustin Harris @Dustin_Harris
Hi @Joakim_Bjerknes , sorry for the late reply!
Try this and let me know if it works for you :)sf.ui.proTools.appActivateMainWindow(); let grabberTool = sf.ui.proTools.mainWindow.cursorToolCluster.grabberTool; if (grabberTool.title.invalidate().value !== "Grabber tool (Time)") { grabberTool.popupMenuSelect({ menuPath: ['Time'], isRightClick: true, }); } else { grabberTool.popupMenuSelect({ menuPath: ['Object'], isRightClick: true, }); }