4
4
4ainik2019-03-03 19:47:31
Windows
4ainik, 2019-03-03 19:47:31

How to emulate button presses in a specific layout?

There is a problem - I wrote a simple program that inserts a timestamp into the current input window by emulating button presses, but there is one "but":
"03Y03Y2019 18Ж48Ж58" :) as you can see, not quite what it should be, namely, if the current input language is Russian, then instead of "." (dot) is printed "u", and instead of ":" (colon) "Ж".
There is an idea to make a forced translation of the layout from Russian to English, and there is such a way, but then I would like to restore it, but here is another "BUT", how to find out which layout, more precisely, the input language is active for the current input window?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
VoidVolker, 2019-03-03
@VoidVolker

To emulate input, use the SendInput API - it allows you to emulate the input of any characters and supports Unicode. Here is an example of usage: https://github.com/nnCron/plugins/blob/master/send...
Well, or you can just download , install nncron as an application, sendinput and strings plugins, and use a task like this:

#( Вставка_даты
WatchHotKey: "@+d" \ Alt+Shift+D
SingleInstance
Action:
BEGIN 
   VK_MENU KEY-PRESSED? 
   [CHAR] D KEY-PRESSED? OR
   VK_LSHIFT KEY-PRESSED? OR
WHILE
  50 PAUSE
REPEAT  
" %DD%/%MM%/%YYYY% %hh%:%mm%" AKEYS
)#

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question