Everything seemed to be running fine, I'm just puttering with things, reading the forum, not even using the KBM Editor, although it's open. Then I started getting a weird error from a macro that is triggered by a Space Change. Here's the last line in the Engine Log:
2023-12-11 00:44:49 Execute an AppleScript failed with script error: text-script:159:175: execution error: System Events got an error: osascript is not allowed assistive access. (-25211). Macro “On Space Change, Notify, Call Recents Sub” cancelled (while executing Execute AppleScript).
I used the "View > Go To Last Aborted Action" menu item (what a wonderful tool) to find that the error is from an AppleScript that has been working fine, dozens of times a day or even an hour, for a couple of weeks.
I pasted the script into Script Debugger and ran it. I got an error popping up:
AppleScript Execution Error
System Events got an error: Script Debugger is not allowed assistive access.
So when KBM runs it, oascript
is not allowed assistive access. When Script Debugger runs it, Script Debugger is not allowed.
But in "Systems Settings > Security and Privacy > Accessibility", both oascript
and Script Debugger are allowed to control the computer. I tried unchecking and rechecking those items in the Accessibility list and it made no difference.
Script Debugger also identified the problematical line. It highlighted
count of windows
in the function definition:
on count_windows_in_current_space(process_name)
tell application "System Events"
tell process process_name
return count of windows
end tell
end tell
end count_windows_in_current_space
WHY would that work for weeks and then suddenly stop working, with an error message about accessibility, that is already properly set?