## Where communities thrive

• Join over 1.5M+ people
• Join over 100K+ communities
• Free without limits
##### Activity
• Jul 22 14:07
Danesprite synchronize #352
• Jul 22 14:07

Danesprite on cleanup-kb-code

Fix a regression with keyboard … (compare)

• Jul 21 15:45
Danesprite commented #350
• Jul 21 15:38
Danesprite commented #350
• Jul 21 15:36
Danesprite commented #350
• Jul 21 14:26
Danesprite assigned #350
• Jul 21 14:26
Danesprite assigned #352
• Jul 21 14:26
Danesprite labeled #352
• Jul 21 14:26
Danesprite labeled #352
• Jul 21 14:26
Danesprite opened #352
• Jul 21 14:09

Danesprite on cleanup-kb-code

Cleanup keyboard code (compare)

• Jul 11 19:14
wolfmanstout commented #326
• Jul 11 18:09
wolfmanstout commented #326
• Jul 11 15:44
Danesprite commented #310
• Jul 11 13:33
Danesprite commented #326
• Jul 10 20:45
lunixbochs commented #326
• Jul 10 20:25
wolfmanstout commented #326
• Jul 10 20:24
wolfmanstout commented #326
• Jul 10 20:20
lunixbochs commented #326
• Jul 10 19:56
wolfmanstout commented #326
Anatole Matveief
@amatveie
@haughki over on the know-brainer forum, in addition to the Dragon capture which Rudiger built and is mentioned by Alex, there's another individual who has developed an alternative to the dictation box that gets pretty good reviews https://www.knowbrainer.com/forums/forum/messageview.cfm?catid=25&threadid=35489&enterthread=y . It might be worth checking out. Select-and-Say definitely does a better job during dictation. In particular it gets the spacing right and usually gets the capitalization rate as well which is a big help. With regards to Notepad++ there is a hack for the registry hack, also documented in 1 of those forum threads, that allows it to get some Select-and-Say functionality, but I don't think it's perfect. If you are adventurous and able to install natlink you could also try Mark's vortex code which will generally enable Select-and-Say for more apps. https://github.com/mdbridge/Vocola-2/tree/vortex . I'm surprised that you have a hard time with Gmail as it seems to work pretty well with me in both chrome and edge. For Slack what I do is use it inside of the web browser, which allows for Select-and-Say vs the Windows app which does not. (I actually go one step further and have it as an 'App' in my taskbar from MS Edge. (Just click on the ... menu->Apps->install the site as an app). In other news there's an effort underway trying to get better dictation support for other apps and speech engines by using the accessibility APIs. But that's certainly not ready for prime time.
Hawkeye Parker
@haughki

@amatveie @alexboche Thank you. I have tried Rudiger's app (Dragon Capture) and SP Pro. Neither of them did exactly what I wanted. If I remember correctly, I hit some crashing bugs with SP. I can't remember exactly what it was with Dragon Capture, but it was a show stopper for me, at least.

Gmail/slack: I think you're talking about the Dragon browser plugin? As I remember, that was truly horrible: resource hogging, crashing. But, I'm on Chrome. I'm so deep in the Google ecosystem, that I'm not sure I could switch to MS Edge -- but, if the plugin really works that much better there, it might be worth it.

James Stout's accessibility API work looks amazing, but more than I want to tackle right now; similar feelings about Vortex.

Honestly, and Notepad works well for me %99 of the time: it's superfast, super lightweight, super stable. It's quick for me to switch back and forth, and I have a "transfer <app>" command which just copies everything and focuses the target application.

So, DragonPad may be it for me for now. Hilarious.

Hawkeye Parker
@haughki
So, just to wrap this thread up (on my end) I've been using DragonPad for all of 30 minutes, and it's buggy as hell in my environment. It's inserting random characters at the end of sentences. If I have more than a few lines of text with some newlines, and I go back and edit "above" in the text, sometimes it just starts inserting my dictation at seemingly random places later in the document. I'm not kidding. So, nonstarter for me.
Anatole Matveief
@amatveie
@haughki Yes DragonPad was completely non workable the last time I tried it. You can also look at James's solution for using notepad as the dictation box https://handsfreecoding.org/2015/08/30/avoid-the-dictation-box/ also note that if the standard Dragon dictation box takes a long time to load up, you could experiment with the keys to send for copy and paste in the settings. I have found that using the Windows copy and paste commands directly versus simulating ctrl+c tends to bring it up quite a bit faster, but will fail in certain applications. With regards to edge versus chrome, in my experience chrome was becoming such a memory hog/CPU hog that was unworkable. For whatever reason the browser plug-in hasn't really given me many problems although it did years ago, so maybe they've been ironing out the bugs? I'm on Dragon 15.61 and I vaguely remember the release notes talking about the browser especially edge since they made the recent change to chromium as the underlying rendering engine. Also maybe there's a setting to do this in chrome, but I find that edge is pretty adamant about putting background tabs to sleep which really helps.
tripfish
@tripfish
@haughki If nothing helps, you can also create a simple dictation box windows application. The RichTextBox element also supports Select-and-Say. I tried it a long time ago. Couldn't find any problems. But I haven't tested it for long.
James Stout
@wolfmanstout

PSA: UI Automation is backwards-compatible with IAccessible2 as of the May 2019 Windows 10 update:
https://docs.microsoft.com/en-us/windows/win32/accessibility/accessibility-whatsnew

This means that my Dragonfly integration with IAccessible2 could be completely replaced with pywinauto and would have greater compatibility. Without having dug into pywinauto, I'm guessing this would be a change for the better from a code cleanliness standpoint because the library I'm currently relying on (pyia2) is very janky.

8 replies
Quintijn Hoogenboom
@quintijn
What is wrong with DragonPad? (For Dragon users)... There is also still WordPad, a light weight word version around. I shall try to revive my Unimacro grammar "_edit.py", https://qh.antenna.nl/unimacro/grammars/globalgrammars/edit/index.html. So: not working at the moment. The idea was always to switch to DragonPad (or other program with full dictation control), either empty, or with a paragraph copied, or with the whole original document copied. With "edit ready" the text is pasted back in the original window. I don't know why I left this grammar, it worked quite nice.
6 replies
LexiconCode
@LexiconCode
What kind of dictation would cause the following error?INFO:dictation.word_parser_factory: Selected word parser class WordParserDns11 because natlink.getWordInfo('.\\dot') returned None Reviewing the dragonfly code it looks like it's an issue handling Dragon special formatting?
Dane Finlay
@Danesprite

Dragonfly2 version 0.31.2 has been released, as of a few days ago. A number of issues with keyboard input on Windows are fixed in this version.

If anyone has had trouble with the Key or Text actions not working properly on Windows, then the new version will probably fix it. This will be relevant mostly to those using keyboard layouts other than QWERTY.

LexiconCode
@LexiconCode
Thanks Dane! That's great!
MeteorVsBunny
@MeteorVsBunny
Key("apps") does not work for me in 31.2, it does work in 31.1
I'm using Windows, caster and Dragon
Dane Finlay
@Danesprite
@MeteorVsBunny Thanks for reporting this! Clearly I should have tested my changes a bit more! Apparently that key, along with some others, is what is called an extended key. I will fix this in the next version.
Dane Finlay
@Danesprite

@MeteorVsBunny That is fixed on the master branch now if you need it, though I'll release version 0.31.3 in the next day or so.

Hopefully this is the last thing wrong with Dragonfly's Windows keyboard code. 🤞

MeteorVsBunny
@MeteorVsBunny
thanks, that was fast
Dane Finlay
@Danesprite
No worries. Well, it wasn't a difficult fix. :-)
DanKaplanSES
@DanKaplanSES
if I use the dictation box and correct the text, then cancel, does that still help the ai?
LexiconCode
@LexiconCode

if I use the dictation box and correct the text, then cancel, does that still help the ai?

My guess the data for the correction is saved before you say cancel to the closeout box.

Is there a way to pass a parameter through function context?
Dane Finlay
@Danesprite

Is there a way to pass a parameter through function context?

Well, you can pass default values FuncContext(function, text=""). What is your use case?

Dane Finlay
@Danesprite
@LexiconCode Ah, okay then. You could have a get_grid_mode_context() function for this:
def get_grid_mode_context(grid):
return FuncContext(lambda: get_grid_mode(grid))
LexiconCode
@LexiconCode
Thanks!
Dane Finlay
@Danesprite
:+1:
LexiconCode
@LexiconCode

Working with function context I had a thought. This could be true all context Classes.
Perhaps it could be a mode parameter to the base Context classes. Based on the type of mode dictates when that context is processed.
timer (Seconds)
call Something similar to get_engine().process_grammars_context() But just for those that are call not all Context and it would only be processed when the function is called.
utterance - The default mode - process every utterance

With timer and call It might allow for functions that you normally would not want to process per utterance due to performance reasons.

LexiconCode
@LexiconCode
Although I acknowledge though these features could be created with function context to achieve similar functionality.
Dane Finlay
@Danesprite
You could implement this with a few Context sub-classes to be used instead. It seems unnecessarily complex to me.
DanKaplanSES
@DanKaplanSES
I have never ever ever been able to train DNS to correct a word or phrase if, when I say it, the list of corrections doesn't include that word as a choice. Is this just the way DNS works? I don't understand the point of "spell that" since it's never done anything useful that I can notice
Dane Finlay
@Danesprite
@tieTYT It sounds like this is just the way DNS works and you have to train misrecognised words separately using "train word".
Hawkeye Parker
@haughki
@tieTYT You might try asking over at https://www.knowbrainer.com/forums/forum/index.cfm. Lot of hardcore dragon users over there. When I add a new word to the vocabulary, I always train it, but I have no clear sense that it really helps. I gave up on "spell that" a long time ago.
DanKaplanSES
@DanKaplanSES

@tieTYT It sounds like this is just the way DNS works and you have to train misrecognised words separately using "train word".

Does that usually fix the problem? Let me give an example, I've never been able to get Dragon to type Eva's. Even after training.

I can get it to say Eva, but Eva's comes out as even as
LexiconCode
@LexiconCode

@tieTYT It sounds like this is just the way DNS works and you have to train misrecognised words separately using "train word".

Does that usually fix the problem? Let me give an example, I've never been able to get Dragon to type Eva's. Even after training.

Did you try dictating it and training it in a sentence rather than an individual word?

DanKaplanSES
@DanKaplanSES
The former, yes. When you say training, you mean training a whole phrase in train word?
If yes, do you add this whole phrase to your vocabulary editor?
LexiconCode
@LexiconCode
Oh I meant to say the correct that Instead of the train word No as a individual word but the surrounding sentence gives Dragon correct that the context of how and when It should be recognized. I've only found the train word to be effective for small changes in pronunciation. For words that sound similar I've had to train them as well.
DanKaplanSES
@DanKaplanSES
ah. Well, as i said above, I have never ever ever been able to train DNS to correct a word or phrase if, when I say it, the list of corrections doesn't include that word as a choice.
And that is often the case with sentences
DanKaplanSES
@DanKaplanSES
I trained a sentence without adding it to the vocabulary editor, and that seems to have fixed it when I say the sentence now?
LexiconCode
@LexiconCode

I trained a sentence without adding it to the vocabulary editor, and that seems to have fixed it when I say the sentence now?

I don't think I've ever tried that. Not sure

Dane Finlay
@Danesprite

I think some of you in this channel might like this example command module. It demonstrates window movement with Dragonfly's Window.move() method, including its optional argument for animating window movement.

https://github.com/dictation-toolbox/dragonfly/blob/master/dragonfly/examples/_window_movement_example.py

The available commands are as follows:

• move [this] window here [animated]
• center [this] window here [animated]
• move notepad [window] here [animated]
• center notepad [window] here [animated]
LexiconCode
@LexiconCode
With BringApp Is there a way to manipulate the window after its open. For example maybe you want the window maximized?
BringApp(editor, 'test_text.txt', focus_after_start=True).execute()
Obviously I could do this in multiple steps but it be nice to have a one-liner :)
BringApp(editor,'test_text.txt', filter_func=lambda window: window.maximize(), focus_after_start=True).execute()
However filter_func is obviously not meant for the purpose described above.
Dane Finlay
@Danesprite
@LexiconCode I would just add an action on the end. If you want to do this more than once, you can define it earlier with one extra line.
maximize_window = Function(lambda: Window.get_foreground().maximize())

action = BringApp(editor, 'test_text.txt', focus_after_start=True) + maximize_window
action.execute()
LexiconCode
@LexiconCode

@LexiconCode I would just add an action on the end. If you want to do this more than once, you can define it earlier with one extra line.

ok that what thought.

Dane Finlay
@Danesprite
We could add an extra argument, but this is flexible and already works.
Dane Finlay
@Danesprite

@/all Dragonfly2 version 0.32.0 has now been released. This version mainly includes bug fixes. There are also a few improvements to the clipboard toolkit. All notable changes are listed in the changelog here: https://dragonfly2.readthedocs.io/en/stable/changelog.html

You can upgrade by running pip install --upgrade dragonfly2.

LexiconCode
@LexiconCode

We could add an extra argument, but this is flexible and already works.

I wouldn't mind mind submitting a PR for BringApp To add an argument post_func that allows for function to be run if BringApp is successful. I could do that in a couple days.
However if you don't think it's worth it's time I will stick with your suggestion :-)

Dane Finlay
@Danesprite
You could add this in a subclass of BringApp if you really need it. I would be against adding a post_func argument because adding an action on the end is a simpler general solution. It is also better for handling exceptions or action failures.
LexiconCode
@lexicon-code:matrix.org
[m]
:point_up: Edit: Both of these options seem too have race condition after BringApp. Is there a better way to do this without adding the pause?
def launch_editor3(editor='notepad'):
# if editer is closed get_matching_windows IndexError: list index out of range
# if editer open background not maximized it will maximize
# if editer open minimized it will maximize
from dragonfly import BringApp, Function, Window
BringApp(editor, 'test_text.txt', focus_after_start=True).execute()
editor = Window.get_matching_windows(title='test_text', executable=editor)[0] # IndexError: list index out of range
if not editor.is_maximized:
editor.maximize()

# if editer is closed it will maximize
# if editer open in background not maximized it will not maximize
# if editer open minimized it will maximize
from dragonfly import BringApp, Function, Window
BringApp(editor, 'test_text.txt', focus_after_start=True).execute()
Function(lambda: Window.get_foreground().maximize()).execute()
David Zurow
@daanzu
@lexicon-code:matrix.org Unfortunately, I think this is an unavoidable result of the windows API not being synchronous. You either have to poll, or write complicated event watching.
LexiconCode
@lexicon-code:matrix.org
[m]
@daanzu: thanks what I figured.
Jaan Altosaar
@altosaar

I had a question about dragonfly -- curious how you all solve problems like saying "right four" which becomes "right for" often (when trying to move the cursor right four times). The same thing happens when saying "enter" and a few other words.

Do you have any advice on navigating this - is there a way to help Dragon(fly) recognize "right four" instead of "right for"?