Replacing press key actions
By Ergin Özler @Ergin_Ozler
Hi,
I am very excited to have written my first macro with Soundflow and wanted to share it. It creates a 5ms fade-in just before the first transient of a clip without affecting it. I merely tab to the transient and trigger the macro. It works fine but consists mainly of press-key actions. Are there better ways to execute some of the steps and make them more stable?
sf.keyboard.press({
keys: "a, ctrl+tab",
});
sf.ui.proTools.nudgeSet({
value: "00:00:00:00.25",
});
sf.keyboard.press({
keys: "alt+numpad minus",
});
sf.keyboard.press({
keys: "cmd+f",
});
sf.ui.proTools.windows.whoseTitle.is("Batch Fades").first.groups.whoseTitle.is("Fade In Operation").first.textFields.first.checkboxSet();
sf.keyboard.type({
text: "5",
});
sf.ui.proTools.windows.whoseTitle.is("Batch Fades").first.groups.whoseTitle.is("Crossfade Operation").first.checkBoxes.whoseTitle.is("Create new crossfades").first.checkboxSet({
targetValue: "Disable",
});
sf.ui.proTools.windows.whoseTitle.is("Batch Fades").first.groups.whoseTitle.is("Fade Out Operation").first.checkBoxes.whoseTitle.is("Create new fade outs").first.checkboxSet({
targetValue: "Disable",
});
sf.ui.proTools.windows.whoseTitle.is("Batch Fades").first.buttons.whoseTitle.is("OK").first.elementClick();
sf.keyboard.press({
keys: "cmd+alt+tab",
});
sf.keyboard.press({
keys: "alt+tab",
});
sf.keyboard.press({
keys: "cmd+alt+tab",
});
- Chris Shaw @Chris_Shaw2022-06-06 21:18:20.291Z
Whenever possible, uses
menuClick
instead of keystrokes.For example in your script you should use:
sf.ui.proTools.menuClick({ menuPath: ["Edit", "Fades", "Create..."] })
Instead of
sf.keyboard.press({ keys: "cmd+f", });