Hi there.
I am using lmc_send_input in order to use commands like Ctrl+W, Ctrl+C etc. These commands work in all languages.
But I needed to type "q" in notepad when my secondary language is selected (NOT english)
I tried:
lmc_send_input(81,0,4)
lmc_send_input(81,0,6)
But unfortunately when I have another language selected it doesnt type, or it types strange characters. Everything works fine when I have English language selected.
Is there a fix so that I can type in English when if I have another language selected in my windows 10 keyboard?
Can you point me out to the right direction on fixing this?
Cant send input in English when other language selected
Re: Cant send input in English when other language selected
lmc is quite transparent with lmc_send_input, it just pass the parameters to windows api function sendinput: https://docs.microsoft.com/en-us/window ... -sendinput
Honestly I have no idea how this function behaves when different keyboard layouts (or languages) are active. You can try to google it.
The only thing I tried are unicode characters (emoji) mentioned in different topic here - for those special chars you need to call sendInput twice and maybe it could also work for regular characters but with different keyboard. I did some tests (to send special unicode chars by double call) but was not able to make it working...
Honestly I have no idea how this function behaves when different keyboard layouts (or languages) are active. You can try to google it.
The only thing I tried are unicode characters (emoji) mentioned in different topic here - for those special chars you need to call sendInput twice and maybe it could also work for regular characters but with different keyboard. I did some tests (to send special unicode chars by double call) but was not able to make it working...
Petr Medek
LUAmacros author
LUAmacros author
Re: Cant send input in English when other language selected
It really prints ";" instead of "q" when greek language is selected, which is something that happens when you also type with physical keyboard. I need to use latin characters only . Is it possible?
Or else is it possible for me to detect the current selected keyboard language and then change it on keypress?
Can you please provide a workaround on this?
Is os.setlocale() supported? Please see the link https://www.gammon.com.au/scripts/doc.p ... .setlocale
Is it possible to use C++ inside lua?
I could use something like
string lang = InputLanguage.CurrentInputLanguage.Culture.Name;
or
string StrCurrentLang = InputLanguage.CurrentInputLanguage.Culture.TwoLetterISOLanguageName;
so that I could check which is the user language and then change it.
You can find more here:
https://stackoverflow.com/questions/277 ... e-computer
Is this possible?
Or else is it possible for me to detect the current selected keyboard language and then change it on keypress?
Can you please provide a workaround on this?
Is os.setlocale() supported? Please see the link https://www.gammon.com.au/scripts/doc.p ... .setlocale
Is it possible to use C++ inside lua?
I could use something like
string lang = InputLanguage.CurrentInputLanguage.Culture.Name;
or
string StrCurrentLang = InputLanguage.CurrentInputLanguage.Culture.TwoLetterISOLanguageName;
so that I could check which is the user language and then change it.
You can find more here:
https://stackoverflow.com/questions/277 ... e-computer
Is this possible?
Re: Cant send input in English when other language selected
You can't use C++ code instead of lua.
I would need to add some built-in functions to detect and/or change keyboard layout.
You can rise feature request at github, but these days I'm active at different sw projects so luamacros is put on hold a little bit.
Can't promise when I do some next development.
I would need to add some built-in functions to detect and/or change keyboard layout.
You can rise feature request at github, but these days I'm active at different sw projects so luamacros is put on hold a little bit.
Can't promise when I do some next development.
Petr Medek
LUAmacros author
LUAmacros author
Re: Cant send input in English when other language selected
I think it would be an awesome feature.
If you ever add this feature, please leave a reply here.
I found a workaround though (to force the characters in english) by setting a Hotkey Combination or Ctrl+Shift+0 in Settings -> Time & Language -> Language -> Choose an input method to always use as default (at the bottom) -> Language Bar Options -> Advanced Key Settings. There I set a specific Hotkey only for English keyboard.
Then all I had to do to force the characters in English is to use before the typing the code below:
If you ever add this feature, please leave a reply here.
I found a workaround though (to force the characters in english) by setting a Hotkey Combination or Ctrl+Shift+0 in Settings -> Time & Language -> Language -> Choose an input method to always use as default (at the bottom) -> Language Bar Options -> Advanced Key Settings. There I set a specific Hotkey only for English keyboard.
Then all I had to do to force the characters in English is to use before the typing the code below:
Code: Select all
lmc_send_input(17, 0, 0) -- press control
lmc_send_input(16, 0, 0) -- press shift
lmc_send_input(48, 0, 0) -- press 0
lmc_send_input(48, 0, 2) -- release 0
lmc_send_input(17, 0, 2) -- release control
lmc_send_input(16, 0, 2) -- release shift