Oh! Then I take that back. It is a native application. It just seems to operate so differently to others that I assumed it had been written using non-Apple frameworks (which is what I meant by non-native), such as ElectronJS or ReactJS, or Java or something that was developing outside the confines of what is provided by the Apple ecosystem.
That error was simply caused by you cancelling the execution (or the script timing out).
I didn't anticipate you'd run the script initially from within KBM. But this was my mistake for assuming your approach would necessarily be the same as mine.
Whenever someone hands you some new code to try, you shouldn't simply plonk it straight into your KBM workflow and cross your fingers. The two main reasons for this are that, while KBM has the means to catch errors from an executing script, it doesn't have the means to introspect the error event and so cant tell you anything meaningful about what went wrong. It also can't return to you every data type that a script could return upon successfully completing execution, and that's pertinent in this case. The second reason is that if you're testing new code, or trying to debug your workflow, you need to do so in an environment where there are the fewest moving parts, i.e. things that are happening other than the execution of the code being tested, which needs to happen in isolation of everything else.
So right now, we have no information about why the script failed. In fact, we have no idea whether the script failed at all, or timed out by itself, or succeeded and returned a type of data that KBM cannot handle.
Therefore, you should launch Script Editor, creating a blank document, and running the script I gave you from there. The Script Editor window has a pane at the bottom that you can pop up, in which the resulting output from a script is displayed.
The obvious reasons for the script to choke is if it references UI elements that don't exist. I just used the same references that you used, which you got from UI browser, but that doesn't mean the references are infallible, and so you need to be able to see what's actually happening when you run the script. The other situation that comes to mind is the unlikely event that the first script doesn't return true
, doesn't return false
, but returns the entire contents of...
that object reference. You said KBM didnt seem to be doing anything except spinning the icon...that's what it would look like if it reaches that point in the script and starts enumerating the descendants of the menu UI element.