![]() |
KnowBrainer Speech Recognition | ![]() |
Topic Title: Keyboard shortcut problem Topic Summary: Need a voice command for a long shortcut Created On: 06/03/2023 03:36 PM Status: Post and Reply |
|
![]() |
![]() |
- jmcvay | - 06/03/2023 03:36 PM |
![]() |
![]() |
- Alan Cantor | - 06/03/2023 03:42 PM |
![]() |
![]() |
- Ag | - 06/03/2023 05:13 PM |
![]() |
![]() |
- monkey8 | - 06/04/2023 06:51 AM |
![]() |
|
I just downloaded an app called CotranslatorAI to facilitate use of ChatGPT as a translation assistance. It has a couple of long keyboard shortcuts for transferring text back and forth between that app apps when the source text is located. One shortcut requires three keys and the other four. Step-by-Step should be an easy way of creating voice commands to activate shortcuts, but it isn't working; the OK button greys out when I depress the second key. Here are the two shortcuts: Ctrl + Shift + Alt Ctrl + Shift + Alt + F12 I've also tried to create voice commands using Advanced Scripting, like so: SendKeys "{CTRL}{ SHIFT}{ALT}" That returns an error message: Description (10111) Invalid key name. - A call to WSALookupServiceEnd was made while this call was still processing. The call has been cancled. Can someone tell me where I'm going wrong. ------------------------- James McVay |
|
|
|
![]() |
|
Not sure how to press only Alt, Ctrl, and Shift at the same time without a fourth key to modify. But the second example should be easy enough:
SendDragonKeys "{Ctrl+Shift+Alt+F12}" You can probably substitute SendSystemKeys. The syntax will be identical. The syntax is different for SendKeys. Using SendDragonKeys or SendSystemKeys will enhance the readability of the code, at least a little. |
|
|
|
![]() |
|
Shift at the same time without a fourth key to modify.
IIRC I think it was you Alan who recently reposted some of @monkey8's code that does stuff like this at an even lower level, allowing the usual basic style scripting code to generate such events. IIRC it was code to hold down the number key or the alt key. Just extend it to hold different keys down.
In AutoHotKey you would do
send,{Blind}{Alt down}{Ctrl down}{Shift down}
Separate events because that's reality[*], hopefully close enough together that your application detection does not trigger on them separately. When you design keyboard bindings when often has to make sure that if you have bound something, e.g. to {Alt down}, it does not do anything that would totally get in the way of what it might want to do if Alt+Ctrl are both held down. Sometimes people use timers...
Do your stuff, then send,{Blind}{Alt up}{Ctrl up}{Shift up}
BEWARE: AutoHotKey sometimes inserts extra events, e.g. it might send {Ctrl Up} just to make sure that the user doesn't see Alt+Ctrl. The {Blind} above is supposed to turn that off, but there are other behaviors that it might not.
Note *: separate key down events because that's "reality": no human can ever press multiple keys at precisely the same time, and even if it did most hardware does not know how to report it. There is an even lower level, but in my experience less reliable: at some point in the pipeline you get keyboard events with modifiers. If you send an event with all 3 of the Ctl-Alt-Shift modifiers down, you can make it appear as they have been set atomically. Possibly even without having seen the key down event for the modifier keys. Which some software finds confusing. Note that I said "most hardware". Most modern hardware like USB keyboards. Back in the old old days we had to scan the keyboard... yada yada yada. Yada yada yada secure communications channel yada yada yada. Old fogey a bloviatiing ...
------------------------- 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. |
|
|
|
![]() |
|
Try this (let me know if it does not work or if one of the previous solutions you have been given does not work) and I will give you another couple of options (obviously just remove the F12 lines for the combination of Ctrl+Shift+Alt only):
' Script 2010 www.pcbyvoice.com ' Declare keyboard events Windows API function Declare Function keybd_event Lib "user32.dll" (ByVal vKey As _ Long, bScan As Long, ByVal Flag As Long, ByVal exInfo As Long) As Long Const VK_CTRL = &h11 Const VK_SHIFT = &h10 Const VK_ALT = &h12 Const VK_F12 = &h7B Sub Main keybd_event(VK_CTRL,0,0,0) keybd_event(VK_SHIFT,0,0,0) keybd_event(VK_ALT,0,0,0) keybd_event(VK_F12,0,0,0) keybd_event(VK_F12,0,2,0) keybd_event(VK_ALT,0,2,0) keybd_event(VK_SHIFT,0,2,0) keybd_event(VK_CTRL,0,2,0) End Sub
------------------------- |
|
|
FuseTalk Standard Edition v4.0 - © 1999-2023 FuseTalk™ Inc. All rights reserved.