Searching:
Triggered by a discussion on the voicecoder discussion list I started working on this again. It is becoming quite a bit of code. Split apart into several things:
- commands for discrete search (noncontinuous) are defined in the grammar _general.
- commands for continuous searching are described in this grammar (_repeat).
- the core functions are in the IniGrammar class
- extensive use is made of "actions
.
The grammar in _general:
command | comment |
search ( for | before | after ) (<dgnletters> | <dgnwords>) | select the text you search for, or a leave the cursor before or after the selected text |
search ( insert | extend ) (<dgnletters> | <dgnwords>) | insert more letters before or after the previous search text |
search new | this opens the default search box, no knowledge of the search text is maintained |
search forward [ {count} [ times ]] | the count is optional, as is times. |
search back [ {count} [ times ]] | in most programs searching back will not work. Search is started from the beginning of the document. |
search go back | (experimental, works only in excel at the moment, go back to where you started.) |
with
<dgnletters> | any combination of letters/characters (alpha, open-paren, comma etc.) |
<dgnwords> | one dictation word (note this is more precise than <dgndictation> which is identical to <_anything> in Vocola) |
The grammar in _repeat:
command |
Search continue [ <direction> | <count> | <speed> ]+ |
with (optional directives (because of the [ and ]):
<direction>: | forward_ | back | up | _down |
<speed>: | steady_ | normal | fast | slow | very fast | _very slow |
<count>: | a number: 1, 2, ..., 20, 25, 30, 35, 40"]] |
And when you are in the continuous mode:
command | comment |
<direction> or <speed> or <count>: | as above |
reverse_ [ direction ] | [ go ] _back | search in the other direction, or start from the top (if back search is not supported) |
<acceleration>: | faster_ | slower | much faster | _much slower |
hold on_ | _hold it | wait, resume with go on | continue or one of the other commands |
cancel | quit the continuous search mode and return, if possible, to the spot the search started from |
Actions
These two grammars are meant to be used with the same grammar rules (commands) in several windows. Therefore they make use of actions. The actions used in the search mechanism are:
meta action | comment |
startsearch | most often simply put the search box on the screen |
search go | often just {enter} |
searchforward | search on in forward (down) direction. |
searchback | search on in opposite direction. Default empty. In that case the search is continued from the top. |
searchgoback | action to go to the place searching started. Excel implemented differently. Word not implemented yet. Default not implemented, UltraEdit (uedit32) implemented. |
searchfailed | what to do if the search failed (can be established in some windows) (default ALERT = a ringing bell) |
searchalwayscontinue | T (True) if you can continue search without an initial search (eg by hand or by the search new command, which is NOT remembered) (values can be T (true) or F (false)) |
leftafterforwardsearch | what to do after forward search, in order to finish in front of the text found. |
leftafterbacksearch | ditto |
In the file actions.ini (which you can open by the command Edit Actions), you can inspect these actions for default or a program (eg winword, dragonpad, firefox (sucks yet),
iexplore, emacs (a little bit), notepad).
Examples- in DragonPad (like in many windows) searching back does not work, so search is started from the beginning of the page when you call this. When you are "round" DragonPad gives an extra dialog window, which is found as a failing search. The search is cancelled at that moment.
- in excel some steps go through internal excel routines, showing no dialog windows at all. When you cancel
the search, or give the command search go back, the cell you start at the search from is selected again. (Searching back does not work).
- In Notepad searching back works, but if you want to go searching for it again this does not work.
- In Firefox continuous search seems to work well, and going up and down with the search also.
- In Word the implementation is primitive, should also be done with internal commands, like in excel.
More implementation details in the section in IniGrammar class
. |