Nudge not working inside of a function
I have a script that works just as inteneded that is, until I put it into a function for do to all clips. As soon as it's in that function the nudge setting no longer works right. Any idea why that would happen?
sf.ui.proTools.appActivateMainWindow();
function makePopGroupEven() {
sf.ui.proTools.menuClick({
menuPath: ["Edit", "Copy"],
});
sf.keyboard.press({
keys: "tab",
});
sf.keyboard.press({
keys: "alt+tab",
});
sf.ui.proTools.nudgeSet({
value: "00:00:01:00.00",
});
sf.keyboard.press({
keys: "comma",
});
sf.keyboard.press({
keys: "comma",
});
sf.ui.proTools.menuClick({
menuPath: ["Edit", "Paste"],
});
sf.keyboard.press({
keys: "shift+tab",
});
sf.ui.proTools.menuClick({
menuPath: ["Clip", "Group"],
});
sf.ui.proTools.nudgeSet({
value: "00:00:00:01.00",
});
sf.keyboard.press({
keys: "tab3",
});
sf.keyboard.press({
keys: "alt+tab",
});
sf.keyboard.press({
keys: "cmd+shift+numpad plus",
});
sf.ui.proTools.waitForNoModals();
sf.keyboard.press({
keys: "ctrl+alt+shift+3",
});
sf.ui.proTools.waitForNoModals();
sf.keyboard.press({
keys: "shift+tab",
});
sf.ui.proTools.menuClick({
menuPath: ["Clip", "Group"],
});
}
sf.ui.proTools.clipDoForEachSelectedClip({
action: makePopGroupEven
});
Any thoughts? Thanks.
- In reply toChipSloan⬆:Chip Sloan @ChipSloan
Right, I already fixed that on my end but that is not the issue. If I take that whole thing out of the function and test it I get perfect results. Once in the function I watch it and can see that the nudge command never sets the value to timecode, only a string of numbers with no punctuation.
Christian Scheuer @chrscheuer2021-03-24 17:26:58.798Z
Hi Chip,
This is because the
clipDoForEachSelectedClip
action works in Samples.
If you need to work in timecode inside the callback function, you'll need to switch to Timecode in the beginning of your function, and back to Samples in the end of the function.Chip Sloan @ChipSloan
Great! Thanks! I'll try that.
C