user86760: I need my Arduino (Leonardo) to open cmd, but if keyboard input language isn’t English it prints another language letters.
——— code ———
Keyboard.begin();
Keyboard.press(KEY_LEFT_GUI);
Keyboard.press('r');
delay(1000);
Keyboard.releaseAll();
Keyboard.write("cmd");
Keyboard.press(KEY_RETURN);
Keyboard.releaseAll();
delay(1000);

——— ——— ———
So my question is: can I somehow detect language, and if it’s not there add it?
My idea was to set languagelist via powershell, and it would be perfect for my program, but I don’t know how I can write English text from Arduino on pc with another language :(
Also my Arduino has sd card, maybe it helps.
——— code ———
powershell $OldList = Get-WinUserLanguageList

powershell Set-WinUserLanguageList -LanguageList en-US -Force

-something

powershell Set-WinUserLanguageList -LanguageList $OldList -Force

——— ——— ———
Sorry if it is 0iq question, I’m very new to Arduino, it will be great to hear your ideas!

user86760: i finaly found a solution for my problem. I wrote an algorithm, that automaticly change system input language if there are only two languages and one of them is English. This code is writen on Duckduino shortcuts, but it is not a problem to convert it back.
DELAY 1000

GUI r
DELAY 1000
STRING powershell
ENTER
DELAY 1000
STRING "ok"
ENTER
DELAY 1000
STRING Set-WinUserLanguageList -LanguageList en-US, ru -Force
ENTER
DELAY 1000
STRING exit
ENTER
DELAY 1000

ALT SHIFT
DELAY 1000
GUI r
DELAY 1000
STRING powershell
ENTER
DELAY 1000
STRING "ok"
ENTER
DELAY 1000
STRING Set-WinUserLanguageList -LanguageList ru, en-US -Force
ENTER
DELAY 1000
ALT SHIFT
DELAY 1000
STRING exit
ENTER
DELAY 1000

GUI r
DELAY 1000
STRING powershell
ENTER
DELAY 1000
STRING "ENGLISH"
ENTER
DELAY 1000

You can use for ru another language, for "ok" i want to add Get-WinUserLanguageList | ConvertTo-Json | Out-File C:\WinUserLanguageList.json to save user's list.

Than language is different than english this code makes errors, and than language is right it changes language list, thats how it works!

Update:
DELAY 1000

GUI r
DELAY 1000
STRING powershell
ENTER
DELAY 1000
STRING Get-WinUserLanguageList | ConvertTo-Json | Out-File C:\WinUserLanguageList.json
ENTER
DELAY 1000
STRING Set-WinUserLanguageList -LanguageList en-US, ru -Force
ENTER
DELAY 1000
STRING exit
ENTER
DELAY 1000

ALT SHIFT
DELAY 1000
GUI r
DELAY 1000
STRING powershell
ENTER
DELAY 1000
STRING Get-WinUserLanguageList | ConvertTo-Json | Out-File C:\WinUserLanguageList.json
ENTER
DELAY 1000
STRING Set-WinUserLanguageList -LanguageList ru, en-US -Force
ENTER
DELAY 1000
ALT SHIFT
DELAY 1000
STRING exit
ENTER
DELAY 1000

GUI r
DELAY 1000
STRING powershell
ENTER
DELAY 1000
STRING "CODE IN ENGLISH"
ENTER
DELAY 1000
STRING exit
ENTER
DELAY 1000

GUI r
DELAY 1000
STRING powershell
ENTER
DELAY 1000
STRING Get-WinUserLanguageList
ENTER
DELAY 1000
STRING $importedFile = Get-Content C:\WinUserLanguageList.json | ConvertFrom-Json
ENTER
DELAY 1000
STRING $langCollection = New-Object System.Collections.Generic.List[Microsoft.InternationalSettings.Commands.WinUserLanguage]
ENTER
DELAY 1000
STRING foreach ($item in $importedFile) {
ENTER
DELAY 1000
STRING $lang = [Microsoft.InternationalSettings.Commands.WinUserLanguage]::new($item.LanguageTag)
ENTER
DELAY 1000
STRING $lang.InputMethodTips.Clear()
ENTER
DELAY 1000
STRING foreach ($inputMethod in $item.InputMethodTips) {
ENTER
DELAY 1000
STRING $lang.InputMethodTips.Add($inputMethod) }
ENTER
DELAY 1000
STRING $lang.Handwriting = $item.Handwriting
ENTER
DELAY 1000
STRING $lang.Spellchecking = $item.Spellchecking
ENTER
DELAY 1000
STRING $langCollection += $lang }
ENTER
DELAY 1000
STRING Set-WinUserLanguageList $langCollection -Force
ENTER
DELAY 1000
STRING Remove-Item C:\WinUserLanguageList.json
ENTER
DELAY 1000
STRING exit
ENTER
DELAY 1000

GUI r
DELAY 1000
STRING https://ma.kak.si
ENTER


user7508: Your Arduino will be virtually typing on a keyboard like this:

© Aon fi – CC-BY 3.0
See the labels on the keys? There are none. Your Windows OS has its
own idea of what each key means, but the Arduino has no way of knowing
that. Instead, you have to tell it explicitly what keyboard layout to
use, e.g.:
Keyboard.begin(KeyboardLayout_fr_FR);

If you don't, the Keyboard library will assume KeyboardLayout_en_US.
There is no way the computer can tell the keyboard what layout it
expects.

86760: <p>I need my Arduino (Leonardo) to open cmd, but if keyboard input language isn’t English it prints another language letters.</p>
<p>——— code ———</p>
<pre><code>Keyboard.begin();
Keyboard.press(KEY_LEFT_GUI);
Keyboard.press('r');
delay(1000);
Keyboard.releaseAll();
Keyboard.write(&quot;cmd&quot;);
Keyboard.press(KEY_RETURN);
Keyboard.releaseAll();
delay(1000);
</code></pre>
<p>——— ——— ———</p>
<p>So my question is: can I somehow detect language, and if it’s not there add it?</p>
<p>My idea was to set languagelist via powershell, and it would be perfect for my program, but I don’t know how I can write English text from Arduino on pc with another language :(</p>
<p>Also my Arduino has sd card, maybe it helps.</p>
<p>——— code ———</p>
<pre><code>powershell $OldList = Get-WinUserLanguageList

powershell Set-WinUserLanguageList -LanguageList en-US -Force

-something

powershell Set-WinUserLanguageList -LanguageList $OldList -Force
</code></pre>
<p>——— ——— ———</p>
<p>Sorry if it is 0iq question, I’m very new to Arduino, it will be great to hear your ideas!</p>
 86760: <p>i finaly found a solution for my problem. I wrote an algorithm, that automaticly change system input language if there are only two languages and one of them is English. This code is writen on Duckduino shortcuts, but it is not a problem to convert it back.</p>
<pre><code>DELAY 1000

GUI r
DELAY 1000
STRING powershell
ENTER
DELAY 1000
STRING &quot;ok&quot;
ENTER
DELAY 1000
STRING Set-WinUserLanguageList -LanguageList en-US, ru -Force
ENTER
DELAY 1000
STRING exit
ENTER
DELAY 1000

ALT SHIFT
DELAY 1000
GUI r
DELAY 1000
STRING powershell
ENTER
DELAY 1000
STRING &quot;ok&quot;
ENTER
DELAY 1000
STRING Set-WinUserLanguageList -LanguageList ru, en-US -Force
ENTER
DELAY 1000
ALT SHIFT
DELAY 1000
STRING exit
ENTER
DELAY 1000

GUI r
DELAY 1000
STRING powershell
ENTER
DELAY 1000
STRING &quot;ENGLISH&quot;
ENTER
DELAY 1000
</code></pre>
<p>You can use for ru another language, for <strong>&quot;ok&quot;</strong> i want to add <code>Get-WinUserLanguageList | ConvertTo-Json | Out-File C:\WinUserLanguageList.json</code> to save user's list.</p>
<blockquote>
<p>Than language is different than english this code makes errors, and than language is right it changes language list, thats how it works!</p>
</blockquote>
<p>Update:</p>
<pre><code>DELAY 1000

GUI r
DELAY 1000
STRING powershell
ENTER
DELAY 1000
STRING Get-WinUserLanguageList | ConvertTo-Json | Out-File C:\WinUserLanguageList.json
ENTER
DELAY 1000
STRING Set-WinUserLanguageList -LanguageList en-US, ru -Force
ENTER
DELAY 1000
STRING exit
ENTER
DELAY 1000

ALT SHIFT
DELAY 1000
GUI r
DELAY 1000
STRING powershell
ENTER
DELAY 1000
STRING Get-WinUserLanguageList | ConvertTo-Json | Out-File C:\WinUserLanguageList.json
ENTER
DELAY 1000
STRING Set-WinUserLanguageList -LanguageList ru, en-US -Force
ENTER
DELAY 1000
ALT SHIFT
DELAY 1000
STRING exit
ENTER
DELAY 1000

GUI r
DELAY 1000
STRING powershell
ENTER
DELAY 1000
STRING &quot;CODE IN ENGLISH&quot;
ENTER
DELAY 1000
STRING exit
ENTER
DELAY 1000

GUI r
DELAY 1000
STRING powershell
ENTER
DELAY 1000
STRING Get-WinUserLanguageList
ENTER
DELAY 1000
STRING $importedFile = Get-Content C:\WinUserLanguageList.json | ConvertFrom-Json
ENTER
DELAY 1000
STRING $langCollection = New-Object System.Collections.Generic.List[Microsoft.InternationalSettings.Commands.WinUserLanguage]
ENTER
DELAY 1000
STRING foreach ($item in $importedFile) {
ENTER
DELAY 1000
STRING $lang = [Microsoft.InternationalSettings.Commands.WinUserLanguage]::new($item.LanguageTag)
ENTER
DELAY 1000
STRING $lang.InputMethodTips.Clear()
ENTER
DELAY 1000
STRING foreach ($inputMethod in $item.InputMethodTips) {
ENTER
DELAY 1000
STRING $lang.InputMethodTips.Add($inputMethod) }
ENTER
DELAY 1000
STRING $lang.Handwriting = $item.Handwriting
ENTER
DELAY 1000
STRING $lang.Spellchecking = $item.Spellchecking
ENTER
DELAY 1000
STRING $langCollection += $lang }
ENTER
DELAY 1000
STRING Set-WinUserLanguageList $langCollection -Force
ENTER
DELAY 1000
STRING Remove-Item C:\WinUserLanguageList.json
ENTER
DELAY 1000
STRING exit
ENTER
DELAY 1000

GUI r
DELAY 1000
STRING https://ma.kak.si
ENTER
</code></pre>
 7508: <p>Your Arduino will be virtually typing on a keyboard like this:</p>
<p><a href="https://commons.wikimedia.org/wiki/File:Happy_Hacking_Keyboard_Professional_2.jpg" rel="nofollow noreferrer"><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/3/33/Happy_Hacking_Keyboard_Professional_2.jpg/640px-Happy_Hacking_Keyboard_Professional_2.jpg" alt="unlabeled keyboard" /></a><br />
© Aon fi – CC-BY 3.0</p>
<p>See the labels on the keys? There are none. Your Windows OS has its
own idea of what each key means, but the Arduino has no way of knowing
that. Instead, you have to tell it explicitly what keyboard layout to
use, e.g.:</p>
<pre class="lang-cpp prettyprint-override"><code>Keyboard.begin(KeyboardLayout_fr_FR);
</code></pre>
<p>If you don't, the Keyboard library will assume <code>KeyboardLayout_en_US</code>.</p>
<p>There is no way the computer can tell the keyboard what layout it
expects.</p>
