Script with Soundflow

Hello I’d like to do some custom macros with Soundflow (from what I understand this is similar to Keyboard maestro) however I am getting stuck in my specific task. Soundflow uses JavaScript, however it seems to not be able to click on the Filter by pitch dialogue. Or at least I haven’t been able to make it work. Does anyone know if Dorico can be scripted to click dialogue buttons (like the Filter by pitch dialogue note pitch selection or others). Here is a link to my Soundflow topic, and I’ll paste the script here for anyone who wants to look at it.

//Select All
sf.keyboard.press({
    keys: "cmd+a",
});
//Open Filter By Pitch
sf.ui.app('com.steinberg.dorico35').menuClick({
    menuPath: ["Edit","Filter","Notes by Pitch..."],
});

//Naturals: C

//Select Note
sf.ui.app("com.steinberg.dorico35").windows.whoseTitle.is("Filter Notes by Pitch").first.children.whoseRole.is("AXMenuButton").whoseTitle.is("C").first.elementClick();
//Select Modifer
sf.ui.app("com.steinberg.dorico35").windows.whoseTitle.is("Filter Notes by Pitch").first.children.whoseRole.is("AXMenuButton").whoseTitle.is("Natural").first.elementClick();
//Confrim In Octave is checked
sf.ui.app("com.steinberg.dorico35").windows.whoseTitle.is("Filter Notes by Pitch").first.checkBoxes.whoseTitle.is("in octave").first.checkboxSet({
    targetValue: "Enable",
});
//Change Octave to value
sf.ui.app("com.steinberg.dorico35").windows.whoseTitle.is("Filter Notes by Pitch").first.children.whoseRole.is("AXIncrementor").whoseTitle.is("").first.elementSetTextFieldWithAreaValue({
    value: "-1",
});
//Select Add
sf.ui.app("com.steinberg.dorico35").windows.whoseTitle.is("Filter Notes by Pitch").first.buttons.whoseTitle.is("Add").first.elementClick();

// D

//Select Note
sf.ui.app("com.steinberg.dorico35").windows.whoseTitle.is("Filter Notes by Pitch").first.children.whoseRole.is("AXMenuButton").whoseTitle.is("D").first.elementClick();
//Select Modifer
sf.ui.app("com.steinberg.dorico35").windows.whoseTitle.is("Filter Notes by Pitch").first.children.whoseRole.is("AXMenuButton").whoseTitle.is("Natural").first.elementClick();
//Confrim In Octave is checked
sf.ui.app("com.steinberg.dorico35").windows.whoseTitle.is("Filter Notes by Pitch").first.checkBoxes.whoseTitle.is("in octave").first.checkboxSet({
    targetValue: "Enable",
});
//Change Octave to value
sf.ui.app("com.steinberg.dorico35").windows.whoseTitle.is("Filter Notes by Pitch").first.children.whoseRole.is("AXIncrementor").whoseTitle.is("").first.elementSetTextFieldWithAreaValue({
    value: "-1",
});
//Select Add
sf.ui.app("com.steinberg.dorico35").windows.whoseTitle.is("Filter Notes by Pitch").first.buttons.whoseTitle.is("Add").first.elementClick();

I’m not familiar with Soundflow, I’m afraid, and I don’t know what mechanism it might be using to try to select user interface elements. The fact that Dorico uses the cross-platform Qt application framework might be a factor in that Dorico doesn’t always use “native” UI elements.

For what it’s worth, if you’re currently having fun and games trying to weed out keyswitch notes after importing MIDI files into Dorico, the next major version of the software will have some good built-in features to help with this.

5 Likes

Hey Daniel, thanks for the update about the anticipated feature in the next release. It sadly doesn’t help me today, but I won’t sink to much time into trying to create this macro via Soundflow then. I’ll still fiddle with it and see if I get anywhere, but I doubt I will. Also good to know that it isn’t using native UI elements, you are likely correct that this is causing the issue. I’ll see if the Soundflow folks have any bright ideas on this front. Cheers!