Voice control custom command with variable? I'd like to be able to declaim &quot;Keyword foo&quot; and have voice control, on hearing this, type :foo for me.
Many of the built-in commands take 'parameters' (i.e., some following speech), so if it were possible to make a user defined command as such it would look like keyword &lt;phrase&gt;, i.e., a 'variable' goes into the command (that variable being &quot;phrase&quot;).
Is there a way to make a user-defined command which takes a variable as input, as many of the built-in commands do?  That would be super useful.
I'm looking into whether it would be feasible to write code in an IDE (in my case, Clojure &amp; Intellij) using only voice control (and perhaps an on screen control pad for help where needed e.g. that provided by the wacom cintiq), thus, keyboard free! - it would be amazing if this were possible.
I haven't yet explored what can be done with &quot;run workflow&quot;.
(I don't see any indication as yet that those can take variables, though).
I've found the location of the default workflows:
/System/Library/PrivateFrameworks/SpeechObjects.framework/Versions/A/Frameworks/DictationServices.framework/Versions/A/Resources/Workflows
mbp:Workflows m$ ll
total 0
drwxr-xr-x  12 root  wheel   384B 14 Dec  2019 ./
drwxr-xr-x  65 root  wheel   2.0K 12 Oct 16:30 ../
drwxr-xr-x   3 root  wheel    96B 14 Dec  2019 New Audio Recording.workflow/
drwxr-xr-x   3 root  wheel    96B 14 Dec  2019 New Screen Recording.workflow/
drwxr-xr-x   3 root  wheel    96B 14 Dec  2019 New Video Recording.workflow/
drwxr-xr-x   3 root  wheel    96B 14 Dec  2019 Show Me Apple Website.workflow/
drwxr-xr-x   3 root  wheel    96B 14 Dec  2019 Show Me Top Albums.workflow/
drwxr-xr-x   3 root  wheel    96B 14 Dec  2019 Show Me Top Family Movies.workflow/
drwxr-xr-x   3 root  wheel    96B 14 Dec  2019 Show Me Top Movies.workflow/
drwxr-xr-x   3 root  wheel    96B 14 Dec  2019 Show Me Top Music Videos.workflow/
drwxr-xr-x   3 root  wheel    96B 14 Dec  2019 Show Me Top Songs.workflow/
drwxr-xr-x   3 root  wheel    96B 14 Dec  2019 Take My Picture.workflow/

Update: realised I may be able to get half way to this by defining a command &quot;To keyword&quot;, which could issue Alt+&lt;- , press ':', then issue Alt+-&gt;.
But that's not just a 'keyboard shortcut', it's three presses. I haven't used automator yet but guess that might be able to do this.
I've got something workable by using &quot;Run Workflow&quot; and the following Apple Script&quot;:
on run {input, parameters}
    activate application &quot;IntelliJ IDEA CE&quot;
    tell application &quot;System Events&quot; to key code 123 using {option down} -- left arrow for back word
    tell application &quot;System Events&quot; to keystroke &quot;:&quot;
    tell application &quot;System Events&quot; to key code 124 using {option down} -- right arrow for fwd word
    -- https://apple.stackexchange.com/questions/36943/how-do-i-automate-a-key-press-in-applescript
    return input
end run

I just have to say the word &quot;foo&quot; as normal then speak a subsequent command &quot;to keyword&quot;, which converts the previous word to a keyword using a sequence of three key presses as above.