First time posting here, KM user for very long time.
Posting because I'm facing issue which is completely unexplainable but it happens.
I'm working on a UI automation project with JXA.
I've written hundreds of scripts and never got this behaviour.
Well, the script is nothing special, accessing a checkbox and clicking it and it works absolutely fine from script editor.
I chose F3 key to trigger this script from Keyboard Maestro but it doesn't run the script.
I checked everything 20 times most probably and everything is fine. If I select the action JavaScript for automation and from it's menu I choose try script option, out of a sudden the script got executed.
But if I try to execute this script by pressing F3 key absolutely nothing happens.
I even tried running simple hello world script, tried some other keystrokes, putting it in different macros but from some reason I can't run this and few more scripts which are as simple as this one and all of them work from script editor.
To me it seems like Keyboard Maestro is preventing this from some reason but I have no idea why would it do something like that because hundreds of other scripts work perfectly fine, with any combination of keys.
Does any of you have some idea what can be cause of this? It's incredibly annoying.
Of course I also tried obvious stuff, restarting Keyboard Maestro, operating system, multiple times.
All of my previous macros work no matter whether they execute some js scripts or not, except these few I mentioned.
The script doesn't matter here. As I already said it perfectly works if I run it from script editor.
From some reason, whatever I put in the script it doesn't work.
This will be ran from script editor, but not from this macro, I've just tried it. Totally unexpected behaviour.
I tried Interactive help. Everything is fine, the macro is triggered, Java script for automation action doesn't show any errors.
In the interactive help, it's said that some apple's accessibility bug or whatever may block the action or something like that.
Obviously, I enabled both KM and KME under security and privacy, that shouldn't be the case I guess.
The weirdest thing here is that this is happening on few scripts only, from no reason. I have hundreds of other scripts and they all work fine, totally unexpected behaviour.
Even if I made some errors in script itself, it would then at least run the above example I wrote but it doesn't.
Here's one of the macros which doesn't work, although script works normally from script editor. But as I mentioned earlier, even if it's hello world script, from some reason it doesn't work.
Everything is more the less depended on external libraries, including these few which don't work.
Give me a sec, I'll rewrite this so necessary functions are included in the script.
As I mentioned previously, it works for me either but if ran from Script Editor.
I'm on latest version of Monterey, MacBook pro 16 2019., Keyboard Maestro is also latest version (10.2).
I've just finished reinstalling Keyboard Maestro, imported all of my macros and still the same. Pretty pretty weird. Gonna try it on my friend's Mac tonight to see will it work on his machine.
This weird behaviour started on Tuesday. I didn't make any changes on my system in last 4 weeks or so.
It literally started behaving like that from nowhere.
AFAIK KM doesn't itself "run" the JavaScript -- it hands it off to osascript. Try the following in the Terminal, keeping an eye on the variable in KM's Preferences pane to see if it changes:
If that works you'll know KM/JXA/macOS is generally OK and it's something specific to the failing macro(s). If it doesn't the JXA action is set to throw up a "results" window, which might give you a clue.