No internet connection
  1. Home
  2. How to

anyone have tips on capturing hard-to-grab UI elements?

By DJH @DJH
    2022-04-21 04:33:02.903Z

    Sorry I don’t have a script example at the moment (hard to make time to post when I’m in front of the computer and meeting deadlines), but there’s been a few times I can’t grab a ui element I need…typically it’s some sort of progress bar window I’m wanting to use as a cue to “disappear” before a macro does another step.

    A fresh example: after a video import is done processing/importing its associated audio (the last step in the video import process), I’ve tried my damndest to get SF to understand when the import is complete by “waiting” for the progress bar window(s) to disappear.

    Problem 1:

    Clicking the “pick” ui element button in the macro editor seems to make the progress bar window invisible to SF. I’ve run into this issue with rx too. And, of course, manually clicking an apps window (like the pro tools edit window or RX) register as the ui element pick.

    My workarounds have been to:

    • right click the app in the MacOS dock and select the target app that way so as to avoid a left click that records in the SF dialog.
    • use a button from an external deck to activate an app, bring it forward, and then use the mouse to click the target UI element.

    But I’ve had mixed results with these approaches. Can’t remember the ins and outs, but am wondering: what are best practices for selecting UI elements in these scenarios?

    Problem 2:
    Using my “fresh example” above w/ importing a video, I did somehow manage to select the progress bar window, or at least a piece of it, but it still doesn’t seem to register and act as a cue for the next step in my macro.

    Again, sorry I’m not posting the actual script, but am wondering if maybe this falls into a general category where a more catch-all solution may work? Like some code that relates to all progress bar windows, no matter the process underway….or something?

    Thanks y’all.

    • 2 replies
    1. A quick reply – you can simulate a normal mouse click while in "pick" mode by doing Cmd+Click. This will do a mouse click but won't "pick" the UI element.

      Wrt waiting for progress bars to complete - take a look at:

      sf.ui.proTools.waitForNoModals();
      
      1. DDJH @DJH
          2022-04-24 16:14:13.317Z

          Fantastic, thx - just the type of tips i was hoping for. Looking forward to trying them out.