KnowBrainer Speech Recognition
Decrease font size
Increase font size
Topic Title: Mapping between MS/Dragon/AutoHotKey/Vocola flavours of Send*
Topic Summary: AHK SendInput = Vocola SendInput... but AHK SendEvent=??, etc.
Created On: 01/18/2022 07:05 PM
Status: Post and Reply
Linear : Threading : Single : Branch
Keyword
 01/18/2022 07:05 PM
User is offline View Users Profile Print this message

Author Icon
Ag
Top-Tier Member

Posts: 775
Joined: 07/08/2019

Many posts in this forum talk about several different flavors of Send,  relative to different tools.

Dragon's SendKeys,  SendSystemKeys and SendDragonKeys

Vocola's SendInput, SendSystemKeys, SendDragonKeys

Windows SendInput,  which AFAICT is essentially is (almost) multiple event  atomicity for keybd_event and mouse_event.

AutoHotKey has 3 primary flavors of Send - SendInput,  SendPlay, and SendEvent -  with the default Send=SendEvent - and SendRaw=Send  without special characters.

 

What is the mapping between these?

 

I suspect that  Windows SendInput is the same as Vocola SendInput,  and is almost the same as AutoHotKey SendInput, except (see below) I think AutoHotKey has some extra non-{Blind}  stuff for reliability,  that can of course be disabled.

 

 

I started off this post by trying to snap various parts of manuals of the various parts of that are relevant, but it got messy so I'll just leave the question:

 

 what is the mapping between the various flavors of Send?    what are the differences?  speed, reliability,  functionality



-------------------------

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.

 01/22/2022 09:50 PM
User is offline View Users Profile Print this message


mdl
Top-Tier Member

Posts: 906
Joined: 04/18/2009

Vocola link on the methods it has for sending keystrokes:

http://vocola.net/v2/SendingKeystrokes.asp

 

I wrote Vocola's SendInput method; it's implemented by calling Windows'

SendInput method, but with a different input syntax designed to match

that of Dragon's SendDragonKeys method.

 

Vocola's other send methods are just wrappers around the similarly named Dragon

methods.

 

AutoHotkey page on the differences of its methods:

https://www.autohotkey.com/docs/commands/Send.htm

 

Dragon's SendDragonKeys is implemented under the cover using

WH_JOURNALPLAYBACK (e.g.,

https://docs.microsoft.com/en-us/windows/win32/winmsg/about-hooks#wh_journalplayback).

I do not know how Dragon's SendSystemKeys is implemented.



 01/23/2022 01:26 AM
User is offline View Users Profile Print this message

Author Icon
kkkwj
Top-Tier Member

Posts: 865
Joined: 11/05/2015

At the low level, Windows has keybd_event (deprecated), SendKeys, and SendInput. The biggest difference is that SendKeys has special characters (%^+ etc) and does some escaping of the special characters. The others do not. The MS doc says that SendInput has two methods under the hood (if the old method fails it apparently rolls over to the "new" method). I have no idea how Vocola/AHK/etc map their APIs into the Windows API.

-------------------------

Win10/11/x64, AMD Ryzen 7 3700X/3950X, 64/128GB RAM, Dragon 15.3, SP 7 Standard, SpeechStart, Office 365, KB 2017, Dragon Capture, Samson Meteor USB Desk Mic, Amazon YUWAKAYI headset, Klim and JUKSTG earbuds with microphones, 3 BenQ 2560x1440 monitors, Microsoft Sculpt Keyboard and fat mouse

 01/23/2022 01:40 PM
User is offline View Users Profile Print this message


mdl
Top-Tier Member

Posts: 906
Joined: 04/18/2009

Beware that there are multiple things called SendInput; I think the one in Visual Basic is the one that talks about two underlying methods.

 

The bottom level one that I'm calling is called from Python via:

## 

## SendInput function:

## 

##   Synthesizes keystrokes, mouse motions, and button clicks.

## 

##       Events is a list of objects that support a to_input() method

##   that returns an Input.  Events can be created directly from the

##   raw data structures ({Mouse,Keyboard,Hardware}Input) or using

##   event-creation convenience functions.

## 

##       Can be blocked by other threads (e.g., BlockInput) or UIPI

##   (applications are not permitted to inject input into applications

##   at a higher integrity level).  The latter causes silent failure.

## 

##       These events are not interspersed with other keyboard or mouse

##   input events inserted either by the user (with the keyboard or

##   mouse) or by calls to keybd_event, mouse_event, or other calls to

##   SendInput.

##

##       This function does not reset the keyboard's current state. Any

##   keys that are already pressed when the function is called might

##   interfere with the events that this function generates. To avoid

##   this problem, check the keyboard's state with the GetAsyncKeyState

##   function and correct as necessary.

## 

 

def send_input(events):

    inputs = [e.to_input() for e in events]

    input = (Input * len(events))(*inputs)

    inserted = windll.user32.SendInput(len(input), byref(input), sizeof(Input))

    if inserted != len(events):

        raise ValueError("windll.user32.SendInput: " + FormatMessage())

 01/23/2022 05:32 PM
User is offline View Users Profile Print this message

Author Icon
Ag
Top-Tier Member

Posts: 775
Joined: 07/08/2019

Thanks guys!!

-------------------------

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.

Statistics
32285 users are registered to the KnowBrainer Speech Recognition forum.
There are currently 0 users logged in.
The most users ever online was 12124 on 09/09/2020 at 04:59 AM.
There are currently 485 guests browsing this forum, which makes a total of 485 users using this forum.

FuseTalk Standard Edition v4.0 - © 1999-2022 FuseTalk™ Inc. All rights reserved.