Is there a way to enter 'tab', 'function' or 'escape' keys as keyboard shortcuts for voice control Mac OS X?

0

1

I am using voice control in Catalina OS beta 5 to map various keyboard shortcuts to custom commands. Most key shortcuts like "command-f" work just fine, but any key shortcut that uses either the 'tab', 'function' or 'escape' key cannot be mapped.

I would like to make a command to use 'function-right arrow'/left arrow, but it isn't accepting the function button...

I've tried copying and pasting key codes from the list included in the accepted answer of this question:

https://apple.stackexchange.com/questions/36943/how-do-i-automate-a-key-press-in-applescript

I am thinking about using AppleScript to tell 'System Events' to do a key press, but I would like to use a keyboard shortcut since it is simpler to implement.

Wenter image description hereould also like to automate hitting 'command-tab', but when I hit tab it unselects 'picker' (not sure what to call it..).

nSquid

Posted 2019-08-19T16:49:45.853

Reputation: 11

Answers

0

When creating new Dictation Commands, sometimes you need to be a little clever with your approach.

For example, the key code command for... fn + right arrow is 119

In Script Editor app, I pasted this following AppleScript code into a new Script Editor document and saved it as "Function Right Arrow.scpt"

tell application "System Events" to key code 119 -- fn + right arrow

Now with your new "Function Right Arrow.scpt" file selected in Finder (and with Enhanced Dictation enabled and active) speak the phrase outloud "Make This Speakable". As in the following image, you will see the options to set up your new Dictation Command

enter image description here

Now anytime I have Enhanced Dictation enabled and active, and I speak the phrase "Function Right Arrow", it will run the script file "Function Right Arrow.scpt" and the keys ... fn + right arrow will be pressed.

Then you would follow the exact same procedure a second time for fn + left arrow. The AppleScript code for that file would be...

tell application "System Events" to key code 115 -- fn + left arrow

wch1zpink

Posted 2019-08-19T16:49:45.853

Reputation: 275

This hasn't quite worked for me yet. I am using voice control on Catalina OS, even though the dialogue "when I say : function right..." picture in your answer is the same as the custom command one in voice control.

I've confirmed that I'm calling the right custom command, since voice control is making the 'sound when command is recognized' sound, and also it displays the text of the command visually after saying.

I tried adding an 'end tell' at the end of the script, but it didn't seem to make a difference.. – nSquid – 2019-08-21T17:05:49.217