![]() |
KnowBrainer Speech Recognition | ![]() |
Topic Title: Vocola 2, Mark would you please... Topic Summary: Created On: 12/11/2021 09:48 PM Status: Post and Reply |
|
![]() |
![]() |
- BigTech | - 12/11/2021 09:48 PM |
![]() |
![]() |
- BigTech | - 12/12/2021 06:21 AM |
![]() |
![]() |
- BigTech | - 12/13/2021 09:01 PM |
![]() |
![]() |
- BigTech | - 12/18/2021 07:39 PM |
![]() |
![]() |
- alexander | - 01/05/2022 09:25 PM |
![]() |
![]() |
- BigTech | - 01/27/2022 07:29 PM |
![]() |
|
...make a modification to your Window.Go() so that it holds the Alt key before asking Windows to switch windows? Please see the 2nd page of the thread I just bumped... "Bring window to front". It goes like... Hold Alt If target window is minimized/iconic, activate it else Switch to target window Release Alt I don't do Python. I had a kludgy C++ method that worked but an update to one of our necessary utilities nuked it. I will pull together all of the C++ code to reliably switch windows, as I recall it's not much. Maybe MFC helps. Thanks. |
|
|
|
![]() |
|
if(GetTitle) I don't use proper casing for variables, and spacing is compact as the computer can read it (except for brace formatting). Happy to help anyway I can... |
|
|
|
![]() |
|
[updated as needed]
Needless disclaimer: Don't do this stuff unless you know what you're doing.
I'm assuming this is okay with Mark (mdl).
In Mark's current window switching extension (vocola_ext_window_switching.py), replace the existing "def switch_to2(window_ID):" block with this...
def switch_to2(window_ID):
I'm guessing bringing up the Taskbar minimized window might not have the same problem as SetForegroundWindow(). Will see. If any problems, maybe also try replacing ShowWindow() with OpenIcon() as in my C++ example since that reliably worked and it appears to be easier, FWIW, it requires only the window handle. But that is not the problem with inconsistent results. The problem is needing to hold the Alt key.
Looks like those "print" commands are communicating with another program or utility.
The timing probably is unnecessary, but I'm inexperienced with "keybd_event". If SendInput() is ever necessary, will deal with it then. SendInput() might require more code.
It should work every time, without exception. |
|
|
|
![]() |
|
OR...
def switch_to2(window_ID):
Seems to behave properly. |
|
|
|
![]() |
|
good job figuring this out. in my case I just did the following
Keys.SendInput({alt_hold}) # apparently this improves the reliability of activating Windows Window.Go_( RegularAnd("Sublime Vocola") "((?!extension).)*$" ) Keys.SendInput({alt_release}) Wait(800) Keys.SendInput({alt_release}) I'm not sure if I needed to send alt_release twice, but I don't think it hurts anything either and it might've made it more reliable. still your solution is probably better |
|
|
|
![]() |
|
My hacks might not work if by chance you are "switching" from the window you are currently in to that same window. I would include an if-then statement, testing for whether I am already in the target window, but offhand I don't know how.
But there is one quick and easy workaround! Just add a click in the lower right-hand corner of your screen to minimize all windows. That only requires a tiny (1/10 second or less) pause for Windows to do its thing. |
|
|
FuseTalk Standard Edition v4.0 - © 1999-2022 FuseTalk™ Inc. All rights reserved.