No internet connection
  1. Home
  2. How to

Dorico Filter Notes by Pitch Script

By Walter Everton @WalterEverton
    2021-10-20 19:48:42.620Z

    Desired Workflow

    So the workflow should be as follows:

    1. Select all
    2. Open Menu Item Filter By Pitch
    3. Select C from the drop down menu
    4. Select Natural from the dropdown menu.
    5. Make Sure "in octave" is checked
    6. Change value to octave -2
    7. Select Add
    8. Repeate for all notes chromatically and enhamonically from C-2 thru F0

    Question

    I would like to add all of my keyswitch notes to filter by pitch (including enharmonic equivilents) in an automated process. However I am getting stuck becuase of the Filter popup dialogue. I'm having trouble selecting the notes menus. I'm sure there is a better way to do the note selection, maybe by defining Variables, but I am not sure how to do that. But I'm not even getting the click UI item to work porperly. It only is selecting everythign if the values are already set in the Filter dialogue (i.e. If the note D is already selected I can't select note C). If everything is preset then the scipt will go through to select the Add button but then get stuck on the next note or modifier. Also the change octave to -2 (or desiered value) is also not functioning as expected. It doesn't change, given the current script.

    Thanks for any help!

    Command Info

    ID: user:default:ckuzvsdyr0006vd10ogndri2i
    Name: Dorico Keyswitch Filter
    

    Source

    //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();
    
    

    Links

    User UID: ufhmuj54Gub8GcCObOqrsT5G2D13

    Feedback Key: sffeedback:ufhmuj54Gub8GcCObOqrsT5G2D13:-MmUEubmohrQG2yKGqjR

    Feedback ZIP

    • 2 replies
    1. Walter Everton @WalterEverton
        2021-10-25 23:02:39.632Z

        Bump?

        1. In reply toWalterEverton:
          Walter Everton @WalterEverton
            2021-10-27 18:49:03.902Z

            So I got a reply (sort of) over on the Dorico forums. The specific task I am attempting to accomplish here will have a solution in the (soon) upcoming version of Dorico, so I won't stress too much about getting a specific solution to this. However I would still like to try and solve this as it will help in future as I find things that I would like to do and can't because of whatever limitation is preventing this script from working. Daniel Spreadbury (one of the lead programmers of Dorico) said they are using "..Dorico uses the cross-platform Qt application framework might be a factor in that Dorico doesn’t always use “native” UI elements." I agree this is likely the factor, but seeing as I don't have a deep understanding of how Soundflow works I was hoping this would help someone here help me find an answer (whether possible or not) to scripting this, and other tasks inside Dorico. Thanks!