No internet connection
  1. Home
  2. Support

How do I invoke Sibelius Plugin and wait for UI element? SF hangs currently

By Scott Stevens @Scott_Stevens
    2024-03-25 23:00:58.022Z

    Hello SF hivemind,

    Soundflow hangs when I use the new Sibelius plugin invoke method. The correct plugin dialog shows, I can't currently add any UI element waits for further automation while SF hangs.

    I think this behavior was resolved for some basic commands that also called dialog windows via an 'async'. Could that be implemented for plugin calls?

    The new speeds are incredible. Excited to take full advantage of it.

    Solved in post #10, click to view
    • 14 replies
    1. S
      SoundFlow Bot @soundflowbot
        2024-03-25 23:00:58.826Z

        Thanks for contacting SoundFlow support.

        Please note, that the best way to get help with a script, macro or other content installed from the Store or content that you've made yourself, is to select the script/macro, then click the red Need help button, and then click "Get help with this script or macro".
        By using this method, we will get access to more information and so should be able to help you quicker.
        You can read more about how this works here: bit.ly/sfscripthelp

        If you're seeing an error that isn't related to scripts or macros, and you think this is a bug in SoundFlow, please file a Help/Issue bug report.
        You can see how to do this by going to bit.ly/sfhelpissue

        1. Kitch Membery @Kitch2024-03-25 23:09:18.651Z

          Hi @Scott_Stevens,

          Did you try this?

          sf.app.sibelius.invokePlugin({
              pluginName: 'RespellFlatsAsSharps',
              'async': true
          });
          

          If you did, and it failed, it may need to be added under the hood.

          Either way, let me know.

          1. Scott Stevens @Scott_Stevens
              2024-03-25 23:18:03.246Z

              Unfortunately yes. Added it to the the following to the plugin call for 'ExchangeStaffContents' and the hang persisted. Same with 'NegativeBarNumberChange'.

              1. Kitch Membery @Kitch2024-03-25 23:23:08.492Z

                Thanks, Scott. It looks like it will need to be added under the hood.

            • S
              SoundFlow Bot @soundflowbot
                2024-03-25 23:19:38.816Z

                This issue is now tracked internally by SoundFlow as SF-1161

                1. The correct plugin dialog shows

                  Hi Scott. Thanks - can you let me know which plugin you were testing with and how I might download it to test here?

                  1. Scott Stevens @Scott_Stevens
                      2024-03-26 01:02:29.851Z

                      Absolutely 👍

                      File => Install Plugins (LH) => Click upper dropdown for “All Plugins” on Install Plugin dialog

                      => Search for ‘Negative Bar Numbers’ => install

                      Repeat above line but search ‘Exchange Staff Contents’

                      => Try invoking either and add an elementWaitFor()
                      For the dialogs that follow the call.

                      1. Thank you! Please note as Kitch mentioned this will require you to use "async mode" since in normal mode, by design, the action waits until the plugin has completed its call before it returns. This is the default behavior because plugins can return values. Async mode means the call is returning before the plugin has finished executing, so in that case you can't get any potential return value.

                        I'm making an experimental build now with async mode support.

                        1. I have this working now with 5.7.7-preview.2:

                          
                          sf.app.sibelius.invokePlugin({
                              pluginName: 'NegativeBarNumberChange',
                              'async': true,
                          });
                          
                          
                          var win = sf.ui.app("com.avid.sibelius").windows.whoseTitle.startsWith("Negative Bar Number Change").first;
                          win.elementWaitFor();
                          
                          var textField = win.textFields.first;
                          textField.elementSetTextAreaValue({ value: '-10' });
                          
                          var btn = win.buttons.whoseTitle.is('OK').first;
                          btn.elementClick();
                          
                          win.elementWaitFor({ waitForNoElement: true, });
                          
                          

                          Manual download link for 5.7.7-preview.2:

                          https://downloads.soundflowcdn.com/5.7/5.7.7-preview.2/beba653301fcb89f/SoundFlow_5.7.7-preview.2.pkg

                          Reply1 LikeSolution
                          1. AAleksander Waaktaar @Aleksander_Waaktaar
                              2024-08-19 08:11:57.380Z2024-08-19 10:24:06.520Z

                              Hi Christian,

                              I am not getting this to work. I am mostly interested in how to invoke plugins in general, but I thought I'd test one from the forums to get started.
                              I get the following error message: "Element was not found or removed after waiting 2000 ms".

                              Any idea what I am doing wrong?

                              // Ensure Sibelius is active and in focus
                              sf.ui.app('com.avid.sibelius').appEnsureIsRunningAndActive();
                              
                              sf.app.sibelius.invokePlugin({
                                pluginName: 'NegativeBarNumberChange',
                                'async': true,
                              });
                              
                              
                              var win = sf.ui.app("com.avid.sibelius").windows.whoseTitle.startsWith("Negative Bar Number Change").first;
                              win.elementWaitFor();
                              
                              var textField = win.textFields.first;
                              textField.elementSetTextAreaValue({ value: '-10' });
                              
                              var btn = win.buttons.whoseTitle.is('OK').first;
                              btn.elementClick();
                              
                              win.elementWaitFor({ waitForNoElement: true, });
                              
                              1. Hi Aleksander,

                                Your code looks correct, so it's hard to tell where it goes wrong without a bit more info. The best way is to start a new thread via the Script Help feature so we have access to your log files.
                                Essentially, if you get this error it can be either because that element in fact didn't show up, or that your script is looking for the element in the wrong way. So we'd need to know what you see when the error occurs.

                                1. Thanks for your quick reply! I'll do that then.

                                  1. After a second reboot it now works perfectly, and with other plugins as well!

                      2. S
                        SoundFlow Bot @soundflowbot
                          2024-03-26 02:47:13.345Z

                          The linked internal issue SF-1161 has been marked as Done