0

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..).

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
| improve this answer | |
  • 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 Aug 21 '19 at 17:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.