-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Always-on window polling for command mode #33
Comments
Make the key for the keypress configurable in settings: "pyHook_KeyID" |
it occurs to me -- you could send a sequence of keys such as "Lshift, Rshift, Rshift, Lshift": such keys won't need to be gobbled up, since they won't alter the window with foculs, so as long as you poll the keyboard and restore any keystates in action (such as shift down), it would be an incognito sequence you could catch and not likely to be a false positive. |
That's a great idea about using the shift key. I've basically got this working now except for one thing. After about 8-11 keypresses, pyHook seems to stop detecting anything, whether i send it via win32 or just by pressing keys on the keyboard. Then, I have to reboot Dragon NaturallySpeaking to make it detect the next 8-11 times. Do you have any idea why that might be? |
Disregard that. It's not 8-11 keypresses, it's 8-11 keypresses which trigger the Mimic action. |
I don't quite follow -- I can't tell if you figured it out yourself, or not. If not, if you can link me to the code it would help. I've never had the hook stop registering, but my hooks only stay on for short periods until they've gathered what they are expecting, and then they shut down until I purposely initiate them by a voice command. |
I haven't figured it out yet. Here are the relevant sections of code. This is the script which runs externally. If it detects that a window has changed at all, it presses whenever key the settings file tells it to, in this case, RShift. It works fine, no problems. This is the one which is run from inside Dragonfly. If it gets inside the if statement on line 35, it will execute those Mimic commands when they are supposed to be executed (when the designated keypress is detected) for the first 8-11 times, then after that, the OnKeyboardEvent callback doesn't execute anymore, nor does it throw any errors. It just fails silently. Also, let me say, whether I figure this out or not, thank you for the suggestion and the help. :-) |
After the failure point, does OnKeyboardEvent get called at all? |
You mentioned that it silently fails, but lack of executing wouldn't qualify in my head as a failure on its part. And I'm happy to help! I'm all about dragonfly coding lately =) |
No, after the failure point, OnKeyboardEvent doesn't get called at all. |
You seem to use a global pyHook manager -- maybe that's the issue -- you I have multiple managers that are at module level, and they don't conflict. You can put debug code in the pyHook code under SubscribeKeyDown to see if On Sun, Mar 8, 2015 at 12:53 AM, David Conway [email protected]
|
I'm pretty sure the hooks weren't being used elsewhere, but you gave me an interesting idea which seems to have solved my problem.
I tried reregistering the hooks every single time a Mimic action is executed, and now they don't shut off. It's not pretty but it works. Thanks again! |
switch actions to caster
As per @chajadan's suggestion, add always-on window polling to monitor when command mode should turn on and off.
The text was updated successfully, but these errors were encountered: