KnowBrainer Speech Recognition
Decrease font size
Increase font size
Topic Title: Looking for tool to generate KnowBrainer/Dragon/... commands from list of keyboard shortcuts
Topic Summary: In case anybody has already written this...
Created On: 02/13/2020 10:38 PM
Status: Post and Reply
Linear : Threading : Single : Branch
 Looking for tool to generate KnowBrainer/Dragon/... commands from list of keyboard shortcuts   - Ag - 02/13/2020 10:38 PM  
 Looking for tool to generate KnowBrainer/Dragon/... commands from list of keyboard shortcuts   - PG LTU - 02/14/2020 09:48 AM  
 Looking for tool to generate KnowBrainer/Dragon/... commands from list of keyboard shortcuts   - Edgar - 02/14/2020 10:53 AM  
 Looking for tool to generate KnowBrainer/Dragon/... commands from list of keyboard shortcuts   - Edgar - 02/14/2020 11:02 AM  
 Looking for tool to generate KnowBrainer/Dragon/... commands from list of keyboard shortcuts   - Lunis Orcutt - 02/14/2020 02:38 PM  
 Looking for tool to generate KnowBrainer/Dragon/... commands from list of keyboard shortcuts   - Lunis Orcutt - 02/14/2020 03:37 PM  
 Looking for tool to generate KnowBrainer/Dragon/... commands from list of keyboard shortcuts   - kkkwj - 02/14/2020 11:33 PM  
 Looking for tool to generate KnowBrainer/Dragon/... commands from list of keyboard shortcuts   - Edgar - 02/15/2020 11:30 AM  
 Looking for tool to generate KnowBrainer/Dragon/... commands from list of keyboard shortcuts   - Mphillipson - 02/15/2020 11:52 AM  
 Looking for tool to generate KnowBrainer/Dragon/... commands from list of keyboard shortcuts   - PG LTU - 02/16/2020 03:08 PM  
 Looking for tool to generate KnowBrainer/Dragon/... commands from list of keyboard shortcuts   - monkey8 - 02/18/2020 06:11 PM  
 Looking for tool to generate KnowBrainer/Dragon/... commands from list of keyboard shortcuts   - Ag - 03/15/2020 08:03 PM  
 Looking for tool to generate KnowBrainer/Dragon/... commands from list of keyboard shortcuts   - Mphillipson - 03/25/2020 02:04 PM  
 Looking for tool to generate KnowBrainer/Dragon/... commands from list of keyboard shortcuts   - Ag - 03/15/2020 08:01 PM  
 Looking for tool to generate KnowBrainer/Dragon/... commands from list of keyboard shortcuts   - dilligence - 03/16/2020 12:19 AM  
 Looking for tool to generate KnowBrainer/Dragon/... commands from list of keyboard shortcuts   - kkkwj - 03/24/2020 11:29 PM  
 Looking for tool to generate KnowBrainer/Dragon/... commands from list of keyboard shortcuts   - R. Wilke - 03/25/2020 03:47 AM  
 Looking for tool to generate KnowBrainer/Dragon/... commands from list of keyboard shortcuts   - kkkwj - 03/25/2020 11:08 AM  
 Looking for tool to generate KnowBrainer/Dragon/... commands from list of keyboard shortcuts   - Bingos - 04/13/2020 01:29 AM  
 Looking for tool to generate KnowBrainer/Dragon/... commands from list of keyboard shortcuts   - Ag - 02/25/2021 11:31 PM  
Keyword
 02/25/2021 11:31 PM
User is offline View Users Profile Print this message

Author Icon
Ag
Top-Tier Member

Posts: 864
Joined: 07/08/2019

well, I am quite happy with my baby steps towards creating a whole bunch of speech commands corresponding to tables of keyboard shortcuts Such as are published for nearly all apps

e.g. https://support.google.com/docs/answer/179738?hl=en#zippy=%2Cpc-shortcuts> 

Here's what I entered today, for Google Docs and Chrome (which I am being forced to use for collaborative documents, much to my disdain)

All of these commands are prefixed (by th re_wrap) function

PUFF
or
PUFF Google Docs
or
PUFF Gdocs


We will see if I remember these a year or so from now. Most of them are pretty trivial so I suspect I will. in fact, many of them are redundant, and that they may already use keyboard shortcuts common to some, many, other apps. But not all other apps, unfortunately.


complicated commands with multiple step tend to be harder to remember.

but even for these, I find that providing variants or aliases for the common cases has helped me greatly. Instead of having to remember whether it's
PUFF Insert page break
or
PUFF insert page
or
PUFF page break
or
PUFF page


I allow all of the above.



the main point of the below is that I just set up a template, and fill in fields. and that it is reasonably compact, so I can see everything close together.


it is still somewhat ugly code, e.g. I really should have an array of the command pattern regular expressions for each Keyboard shortcut, rather than having to rely on (big|Regex|alternatives). refactoring use objects state rather than long parameter lists. Cleaning that up will make things even easier to read.

But even in this quick and dirty state, it has saved me a lot of time.




cck_tuples.push( { context: "- Google Docs - Google Chrome"
, keys: "^v", regex: re_wrap("paste with formatting") } )
cck_tuples.push( { context: "- Google Docs - Google Chrome"
, keys: "^+v", regex: re_wrap("paste without formatting") } )

cck_tuples.push( { context: "- Google Docs - Google Chrome"
, keys: "^z"
, regex: re_wrap("undo") } )

cck_tuples.push( { context: "- Google Docs - Google Chrome"
, keys: "^+z"
, regex: re_wrap("redo") } )

cck_tuples.push( { context: "- Google Docs - Google Chrome"
, keys: "!/"
, regex: re_wrap("(Search menus?|menu search)") } )

cck_tuples.push( { context: "- Google Docs - Google Chrome"
, keys: "^/"
, regex: re_wrap("( list)?keyboard shortcuts( list)?") } )

cck_tuples.push( { context: "- Google Docs - Google Chrome"
, keys: "^k"
, regex: re_wrap("(insert|edit)? link") } )

cck_tuples.push( { context: "- Google Docs - Google Chrome"
, keys: "!{Enter}"
, regex: re_wrap("Open link") } )

cck_tuples.push( { context: "- Google Docs - Google Chrome"
, keys: "^+f"
, regex: re_wrap("((hide|show|toggl) menus|compact mode)") } )

cck_tuples.push( { context: "- Google Docs - Google Chrome"
, keys: "^{Enter}"
, regex: re_wrap("(insert )?page( break)?") } )

cck_tuples.push( { context: "- Google Docs - Google Chrome"
, keys: "^y"
, regex: re_wrap("repeat( last action)?") } )

cck_tuples.push( { context: "- Google Docs - Google Chrome"
, keys: "^b"
, regex: re_wrap("Bold") } )

cck_tuples.push( { context: "- Google Docs - Google Chrome"
, keys: "^i"
, regex: re_wrap("italic(s|ize)?") } )

cck_tuples.push( { context: "- Google Docs - Google Chrome"
, keys: "^u"
, regex: re_wrap("underline") } )

cck_tuples.push( { context: "- Google Docs - Google Chrome"
, keys: "!+5"
, regex: re_wrap("strike ?through") } )

cck_tuples.push( { context: "- Google Docs - Google Chrome"
, keys: "^."
, regex: re_wrap(" superscript") } )

cck_tuples.push( { context: "- Google Docs - Google Chrome"
, keys: "^,"
, regex: re_wrap(" subscript") } )

cck_tuples.push( { context: "- Google Docs - Google Chrome"
, keys: "^!c"
, regex: re_wrap("copy text formatting") } )

cck_tuples.push( { context: "- Google Docs - Google Chrome"
, keys: "^+v"
, regex: re_wrap("paste text formatting") } )

cck_tuples.push( { context: "- Google Docs - Google Chrome"
, keys: "^{space}"
, regex: re_wrap("clear text formatting") } )

cck_tuples.push( { context: "- Google Docs - Google Chrome"
, keys: "^+>"
, regex: re_wrap("(larger|increase font size)") } )

cck_tuples.push( { context: "- Google Docs - Google Chrome"
, keys: "^<"
, regex: re_wrap("(smaller|decrease font size)") } )

cck_tuples.push( { context: "- Google Docs - Google Chrome"
, keys: "^]"
, regex: re_wrap("indent") } )

cck_tuples.push( { context: "- Google Docs - Google Chrome"
, keys: "^["
, regex: re_wrap("(unindent|undent)") } )

cck_tuples.push( { context: "- Google Docs - Google Chrome"
, keys: "^!0"
, regex: re_wrap("(heading off|no heading|heading (0|zero)|normal( text)?( style)?)") } )

;; TBD: Heading speech commands - Conflict with OneNote headings
cck_tuples.push( { context: "- Google Docs - Google Chrome"
, keys: "^!1"
, regex: re_wrap("heading (1|one)") } )
cck_tuples.push( { context: "- Google Docs - Google Chrome"
, keys: "^!2"
, regex: re_wrap("heading (2|Two|to)") } )
cck_tuples.push( { context: "- Google Docs - Google Chrome"
, keys: "^!3"
, regex: re_wrap("heading (3|three)") } )
cck_tuples.push( { context: "- Google Docs - Google Chrome"
, keys: "^!4"
, regex: re_wrap("heading (4|four)") } )
cck_tuples.push( { context: "- Google Docs - Google Chrome"
, keys: "^!5"
, regex: re_wrap("heading (5|five)") } )
cck_tuples.push( { context: "- Google Docs - Google Chrome"
, keys: "^!6"
, regex: re_wrap("heading (6|six)") } )

cck_tuples.push( { context: "- Google Docs - Google Chrome"
, keys: "^+l"
, regex: re_wrap("(left align|align left|justify left|left justify)") } )

cck_tuples.push( { context: "- Google Docs - Google Chrome"
, keys: "^+r"
, regex: re_wrap("(right align|align right|Justify right|right justify)") } )

cck_tuples.push( { context: "- Google Docs - Google Chrome"
, keys: "^+e"
, regex: re_wrap("Center( align)?") } )

cck_tuples.push( { context: "- Google Docs - Google Chrome"
, keys: "^+j"
, regex: re_wrap("justify") } )

cck_tuples.push( { context: "- Google Docs - Google Chrome"
, keys: "^+7"
, regex: re_wrap("numbered list") } )

cck_tuples.push( { context: "- Google Docs - Google Chrome"
, keys: "^+8"
, regex: re_wrap("(bullets?|bullet(ed)? list)") } )

cck_tuples.push( { context: "- Google Docs - Google Chrome"
, keys: "^+{up}"
, regex: re_wrap("move paragraph up") } )

cck_tuples.push( { context: "- Google Docs - Google Chrome"
, keys: "^+{down}"
, regex: re_wrap("move paragraph down") } )


;;; TBD: WIP: add image and drawing commands I skipped over

cck_tuples.push( { context: "- Google Docs - Google Chrome"
, keys: "^!m"
, regex: re_wrap("(insert )?comment") } )

cck_tuples.push( { context: "- Google Docs - Google Chrome"
, keys: "^!+a"
, regex: re_wrap("open discussion thread") } )

cck_tuples.push( { context: "- Google Docs - Google Chrome"
, keys: "^!f"
, regex: re_wrap("insert footnote") } )

cck_tuples.push( { context: "- Google Docs - Google Chrome"
, keys: "^+\\"
, regex: re_wrap("Context menu") } )

cck_tuples.push( { context: "- Google Docs - Google Chrome"
, keys: "!+f"
, regex: re_wrap("File menu") } )

cck_tuples.push( { context: "- Google Docs - Google Chrome"
, keys: "!+e"
, regex: re_wrap("view menu") } )

cck_tuples.push( { context: "- Google Docs - Google Chrome"
, keys: "!+i"
, regex: re_wrap("insert menu") } )

cck_tuples.push( { context: "- Google Docs - Google Chrome"
, keys: "!+o"
, regex: re_wrap("format menu") } )

cck_tuples.push( { context: "- Google Docs - Google Chrome"
, keys: "!+t"
, regex: re_wrap("tools menu") } )

cck_tuples.push( { context: "- Google Docs - Google Chrome"
, keys: "^+h"
, regex: re_wrap("help menu") } )

---

 

BTW the ugly indentation is largely an artifact of AutoHotKey's syntax for continuing statements across multiple lines. Combined with an incomplete emacs AHK-mode.

 

Eventually I hope to get it to  a single line per command

ctx :=  Recognizer().set_context(""- Google Docs - Google Chrome")

ctx.add(  { keys: "^+h", regex: re_wrap("help menu") } )
ctx.add(  { keys: "^+o", regex: re_wrap("format menu") } )

or

ctx.add(  [ "comment: begin"",
, [ "^+h",       "help menu" ]
, [ "^+o",       "format menu" ]
, "comment: end"  )

 always trying to make it look as close as possible to the tables one season help webpages

 

---

 

 BTW ++: I find it more pleasant to make actual running code look like the table of keyboard shortcuts and commands, then to take such a table  in a data structure like CSV and generate code. Because in the latter case when you're debugging the code you have to go back and fix the original table and then regenerate, or, if you fix a bug in the generated code, you risk losing it if you regenerate. It's like code wizards, which are a well-known  way of  quickly creating a lot of code that is hard to upgrade and maintain.

 



-------------------------

DPG15.6 (also DPI 15.3) + KB, Sennheiser MB Pro 1 UC ML, BTD 800 dongle, Windows 10 Pro, MS Surface Book 3, Intel Core i7-1065G7 CPU @ 1.3/1.5GHz (4 cores, 8 logical, GPU=NVIDIA Quadro RTX 3000 with Max-Q Design.



Statistics
32359 users are registered to the KnowBrainer Speech Recognition forum.
There are currently 0 users logged in.
The most users ever online was 12124 on 09/09/2020 at 04:59 AM.
There are currently 425 guests browsing this forum, which makes a total of 425 users using this forum.

FuseTalk Standard Edition v4.0 - © 1999-2022 FuseTalk™ Inc. All rights reserved.