Button Click Unreliable

Hi guys,

Firstly, KM rocks. Love it.

My issue: I’m trying to click on a button in an (audio) plugin interface in Logic. In this particular plugin, clicking the button with the mouse always works, but clicking it with KM’s Click action (correct co-ordinates) is unreliable - sometimes the button triggers, sometimes it doesn’t.

I’ve tried a bunch of ways around this, eg making sure the window is activated, clicking the plugin background first to make sure we have focus, clicking the button more than once, various delays, different click types etc, but I still can’t get a single, reliable button click using KM. Often if I KM click the button two or three times, the button will always trigger, but it will occasionally trigger twice in this process, so that’s not a reliable solution anyway.

I’m sure this is something to do with this particular plugin’s framework, not a KM issue per se, but I’m wondering if there is anything else to try to get this to work, as clearly in this case, there seems to be a difference between a real mouse click, and a KM generated one - and it’s the first time this has been an issue for me…

Any suggestions welcome while I continue to find a solution for this… thanks!

Edit: Additional note: I use tap to click on the MBP trackpad, and using a trackpad tap to click on this button is similarly unreliable, the plugin requires a full, hard click to be reliable. That might give some clues…

And in Debugging mode, stepping through the actions, the button click works reliably every time, interestingly enough…

(KM 8.0.5 BTW)

I frequently encounter these same symptoms, right down to the things works when I open Debug Mode.

I don’t know the cause but I have a workaround which I will include here in English pseudocode:

UNTIL
click on button
pause 0.3 seconds
UNTIL button looks clicked (using FIND IMAGE action or conditional)

Sometimes you have to move the mouse after clicking on the button because some buttoins change colour when a mouse is hivering ob=ver them.

Thanks, good to know this isn’t a one off!

I can’t use that exact solution as the button is momentary, not a toggle, so it looks the same once clicked.

I have implemented a hacky workaround for now, which is try to press the button, and evaluate some text, which should have changed since the last time around the loop - if it hasn’t, we can assume the button click failed, and retry the loop again - so this will continue to loop on the one iteration until we get a valid button click and the text has changed.

Again, not an optimal solution, but it gets me out of an immediate hole…

You may still have options. I have some options for you to try. (The last one is the simplest, and may be your real problem.) Try the following action: (using your application [instead of Calendar] and the menu item corresponding to your button, if there is a correlation.)

This form of button clicking is implemented differently and therefore may have a different reliability. But if not it may get you a way to detect if the button clicked or failed using the "Last Action Result" condition. If the result of that action is NOT OK then that means it wasn't pressed, I imagine.

Thirdly, going back to my original solution, there may be either a visual or audible media effect coming from pressing the button if it works. Typically when a button works the text on the button drops down to the right by a few pixels. This doesn't seem like much, but I'll bet it's enough for a meticulously written KM action to detect it. Anything your eyes can see, so can KM.

Fourthly, instead of doing a click, which may not always work due to the way that app works, try this instead: (this is a click/hold/pause/release which may help with certain kinds of programs)

Fifthly, and this is the simplest of all, just PRIOR to doing your click, insert a PAUSE 0.1 SECONDS actins. I find this works i some cases where there was a previous iteration with the mouse and the OS needs a bit of tie before the next action can be recognized. Based on years of experience I'll bet this is the exact cause of your problem.

Thanks for the suggestions:

  1. Menus - I can’t use menus, this is a plugin in an application and it doesn’t have menus or key commands or any other way to trigger the desired action. If there was, I’d have tried it already! :slight_smile:

  2. Last Action Result - thanks for the tip, I will give this a try and see what happens. My guess here is that the action just sends a mouse event and therefore should always succeed - it’s the button itself that doesn’t respond. But I will give this a try and see… (Edit: Checked, it behaves as expected, the action result is ok, even when the button doesn’t respond.)

  3. Yes, when the button is pressed, it does change colour for a very small window of time, and this might be enough to do an image search (which I use elsewhere). I’d stayed away from this for now because it’s such a short window of time to detect it, but it’s probably worth a try.

  4. Yes, I tried all combinations of clicks, click-holds, click, pause, release etc, including your example, no difference in response.

  5. Yes, I’m doing all kinds of pauses, before after, during, nothing affects the button response. It seems the issue is that the button just doesn’t respond to about 80% of tap/click events, no matter what generates them.

I’m interested in the difference between a tap, and a click event, as the button is 100% reliable when clicking with mouse or trackpad full click. But it seem KM’s “click” action is sending the same kind of event as the trackpad’s “tap”, and so the button responds the same way - just missing 80% of the tap events.

Of the suggestions (again, thanks, I’m grateful for the help and to be able to talk it through), detecting the button colour change might work, but is essentially just a slightly faster way of doing what I’m already doing (ie, if the button click didn’t work, try again).

I think what I’m really after was a way for KM to do a “click” that results in the same event being sent as a full mouse “click”, as I don’t understand the differences between them…

I don’t know the internal mechanics of KM’s click. However one time I was having a similar problem with an intransigent app and I found a very small app online that I felt was small enough to be trustworthy and it worked 100% of the time with the app. However it may take me some time to dig up its name. I haven’t used it in years.

Thanks - I achieved my aim for now with the workaround of retrying the button clicks until it worked - as this was a batch script for essentially a one-time procedure that ran overnight, I’m not too worried about it for now.

(The image search on the button wouldn’t work in this case BTW, as the button barely visibly toggles.)

Obviously it would be good to pursue these little niggles with follow ups should anyone else happen to have the same issue, though, so if you or anyone else has any followup info that would be interesting.

Thanks again!