Archive.zip (310.8 KB)
I wrote a pretty simple AppleScript to fire up dictation tool:
Unfortunately, It doesn't work. I traced the error in the Console.app:
So it's a permission issue. I tried to reset permissions with CLI:
tccutil reset AppleEvents
But without luck - it seems like BTT doesn't request Automation permission anymore.
After permission reset, I also tried to fire up this in iTerm:
osascript -e 'tell application "System Events" to key code 54' \
-e 'delay 0.1' \
-e 'tell application "System Events" to key code 54'
And, unlike BTT, it successfully requested permissions.
Unfortunately that is a system issue. Sometimes a restart can fix it, but in other cases only a full tcc database reset can help.
Possibly also try to reset using sudo, depending on the macOS version that has worked better in the past:
sudo tccutil reset AppleEvents com.hegenberg.BetterTouchTool
Apps can not request these permissions theirselves, this is automatically triggered by the system - and unfortunately the system can sometimes fail
I digged a little deeper and found out that some software (BTT and Karabiner, at least) don't like disabled SIP very much - it appeared to be the issue in this case too.
I re-enabled SIP, and permission request appeared again. But, for some reason, issue persists. Now I can't find any errors in the Console.app (neither in the BTT logs). I'll try to find something and report back.
Yes there are quite some extra system bugs if SIP is disabled - it is clear this is not a usecase Apple wants to support.
What is your script supposed to do?
There's three cases in my mind:
- To start dictation
- To start a virtual keyboard
- I have some strange behavior with z-index of floating menu when full screen application is active. I will try to fix it with AppleScript, but I'm not sure yet.
I'm using my machine as a "media box" with Siri remote, so this can be a great addition. Also planning to share preset with floating menu when it'll be done.
Simulating CMD for this can work but is more fragile than other shortcuts.
If you can't get this to work I'd recommend to use BTT's predefined action "Start Siri" (if it is for siri) or send the mic key to start dictation or use the predefined action "Trigger Menubar Menu Item" to trigger "Edit;Start Dictation"