No internet connection
  1. Home
  2. How to

Click UI element help

By Josh Reinhardt @Josh_Reinhardt
    2023-06-29 05:35:35.877Z2023-06-29 17:26:55.255Z

    I'm trying to create a macro that clicks the radial button next to track. I can only get it to work 1 time.

    I realize that the marker window changes what it looks like so maybe soundflow doesn't recognize the window after it opens with another location.

    Does anyone know how to do this or if there is some workaround? Any Help would be appreciated.

    Thanks,

    Solved in post #8, click to view
    • 12 replies
    1. Kitch Membery @Kitch2023-06-29 18:04:34.741Z

      Hi @Josh_Reinhardt

      Are you using the following code to select the radio button?

      sf.ui.proTools.newMemoryLocationDialog.radioButtons.whoseTitle.is("Track:").first.elementClick();
      
      

      Please note that Radio buttons don't work like checkboxes in that they can only be selected not toggled (in case that's what you are trying to do) To deselect the "Track" radio button you'd need to click the "Main Ruler" radio button.

      If you want to toggle the button you could use a script like this:

      const newMemoryLocationDialog = sf.ui.proTools.newMemoryLocationDialog;
      const radioButtons = newMemoryLocationDialog.radioButtons;
      const trackRadioButton = radioButtons.whoseTitle.is("Track:").first;
      const mainRulerRadioButton = radioButtons.whoseTitle.is("Main Ruler").first;
      
      if (trackRadioButton.value.invalidate().intValue === 0) {
          trackRadioButton.elementClick();
      } else {
          mainRulerRadioButton.elementClick();
      }
      
      1. JJosh Reinhardt @Josh_Reinhardt
          2023-06-29 19:01:36.475Z

          The second script worked! Thanks!

          1. JJosh Reinhardt @Josh_Reinhardt
              2023-06-29 19:05:11.047Z

              It worked once but after trying again it gave this error "Couldn't locate AxElementArrayIndexedItem (MarkerTrackScript: Line 6)"

              Do I need to use both lines you provided? I havent used script before.

              1. Kitch Membery @Kitch2023-06-29 19:09:55.101Z

                Can you provide more information on what you are trying to achieve and the steps you would take to achieve the workflow manually?

                When you say that the "marker window changes" how does it change? Screenshots of the window changes may be helpful for troubleshooting this.

                1. JJosh Reinhardt @Josh_Reinhardt
                    2023-06-29 20:15:09.747Z

                    just the information in the window itself changes for example the location number is different for every marker that is created. Thus Soundflow might not see the new window because of the changed information. I'm not sure if that is how it works its just my assumption. However I just figured out a workaround apparently, OPTION+UP or DOWN keys will change the radial. So I can just make a macro that does that. Thanks for your help!

                    ReplySolution
                    1. Kitch Membery @Kitch2023-06-29 20:22:26.958Z

                      Can you take 2 screenshots with the changes you are talking about?

                      Using UI automation rather than simulating keyboard presses is always more stable.

                      Also, can you explain the full workflow that you are trying to achieve? Having more context may allow me to create something that is quite robust using only UI automation.

                      Rock on!

            • J
              In reply toJosh_Reinhardt:
              Josh Reinhardt @Josh_Reinhardt
                2023-06-29 20:53:53.271Z

                All I want is a button on soundflow that will engage the "track" selection when needed. This way I can pin notes to tracks if necessary.

                1. Kitch Membery @Kitch2023-06-29 21:26:29.215Z

                  Thanks @Josh_Reinhardt,

                  I understand that much.

                  My original code below should do this.

                  sf.ui.proTools.newMemoryLocationDialog.radioButtons.whoseTitle.is("Track:").first.elementClick();
                  

                  Or you could create a macro using the "Click UI Element" Macro action, using the pick button to select the "Track" Radio Button, like this.

                  Pleas note that the Radio button needs to be visible to be clicked.

                  If this continues failing on the second attempt, I'll need to know the steps you took and what changed after running the script or macro the first time to be able to know why it's failing. Or better still, use the red "Need Help" button in the editor, which will help gather all the information the community needs to hopefully resolve the issue.

                  :-)

                  1. JJosh Reinhardt @Josh_Reinhardt
                      2023-06-29 21:33:51.595Z

                      The click UI element works once and then if I close the original window try to open a new marker window it will fail every subsequent time. I'm not sure why.

                      1. Kitch Membery @Kitch2023-06-29 21:41:03.295Z

                        Ahhh great that's the context I needed. Let me take a look. :-)

                        1. In reply toJosh_Reinhardt:
                          Kitch Membery @Kitch2023-06-29 21:52:23.679Z

                          Ahh yes, it looks like the Memory Location Dialog window needs to be invalidated. Try this script.

                          sf.ui.proTools.newMemoryLocationDialog.invalidate().radioButtons.whoseTitle.is("Track:").first.elementClick();
                          

                          Let me know if that works for you. :-)

                          1. JJosh Reinhardt @Josh_Reinhardt
                              2023-06-30 04:28:35.413Z

                              Yes Sir! Thanks!!