Functions
Main Functionsโ
Command | Example | Description |
---|---|---|
# or REM | # Hello World! | Comment |
DEFAULTDELAY or DEFAULT_DELAY | DEFAULTDELAY 200 | Time in milliseconds between every command |
DELAY | DELAY 1000 | Delay in milliseconds |
STRING | STRING Hello World! | Types the following text |
STRINGLN | STRINGLN Hello World! | Like STRING but presses enter at the end |
REPEAT or REPLAY | REPEAT 3 | Repeats the previous line n times |
๐ More functions below
Keyboard Layoutโ
You can also change the default keyboard layout in the preferences.json. That way, you don't have to use LOCALE in your script.
Use LOCALE
to change the keyboard layout. This is necessary for everyone who's not using the US keyboard.
Otherwise, your BadUSB might type the wrong characters.
Here's an example using the German keyboard layout:
LOCALE DE
STRING Gรคnsefรผรchen
Available Keyboard Layoutsโ
Region | Standard Layout | Mac Layout | Note |
---|---|---|---|
Belgium ๐ง๐ช | BE | BE_MAC | |
Bulgaria ๐ง๐ฌ | BG | BG_MAC | |
Canada ๐จ๐ฆ | CA-CM , CA-FR | CA-FR_MAC | |
Switzerland ๐จ๐ญ | CH-DE , CH-FR | CH-DE_MAC , CH-FR_MAC | |
Czech Republic ๐จ๐ฟ | CZ | CZ_MAC | |
Germany ๐ฉ๐ช | DE | DE_MAC | |
Denmark ๐ฉ๐ฐ | DK | DK_MAC | |
Estonia ๐ช๐ช | EE | EE_MAC | |
Spain ๐ช๐ธ | ES | ES_MAC | |
Latin-America ๐ | ES-LA | ES-LA_MAC | |
Finland ๐ซ๐ฎ | FI | FI_MAC | |
France ๐ซ๐ท | FR | FR_MAC | |
United Kingdom ๐ฌ๐ง | GB | GB_MAC | |
Greece ๐ฌ๐ท | GR | GR_MAC | |
Croatia ๐ญ๐ท | HR | HR_MAC | Since v1.2.1 |
Hungary ๐ญ๐บ | HU | HU_MAC | |
Ireland ๐ฎ๐ช | IE | - | |
India ๐ฎ๐ณ | IN | IN_MAC | |
Iceland ๐ฎ๐ธ | IS | IS_MAC | |
Italy ๐ฎ๐น | IT | IT_MAC | |
Latvia ๐ฑ๐ป | LT | LT_MAC | |
Lithuania ๐ฑ๐น | LV | LV_MAC | |
Netherlands ๐ณ๐ฑ | NL | NL_MAC | |
Norway ๐ณ๐ด | NO | NO_MAC | |
Poland ๐ต๐ฑ | PL | PL_MAC | |
Brazil ๐ง๐ท | PT-BR | PT-BR_MAC | |
Portugal ๐ต๐น | PT | PT_MAC | |
Romania ๐ท๐ด | RO | RO_MAC | |
Russia ๐ท๐บ | RU | RU_MAC | |
Sweden ๐ธ๐ช | SE | SE_MAC | |
Slovenia ๐ธ๐ฎ | SI | SI_MAC | |
Slovakia ๐ธ๐ฐ | SK | SK_MAC | |
Turkey ๐น๐ท | TR | TR_MAC | |
Ukraine ๐บ๐ฆ | UA | UA_MAC | |
United States ๐บ๐ธ | US | US_MAC |
Multi-Line Commentsโ
If you have a lot to say, you can use multi-line comments using ###
:
###
The quick brown
fox jumps over
the lazy dog
###
Large Stringsโ
For longer texts, use LSTRING_BEGIN
and LSTRING_END
.
Everything between those two commands, including linebreaks, gets typed out:
LSTRING_BEGIN
The quick brown
fox jumps over
the lazy dog
LSTRING_END
Loopsโ
To repeat one or more lines, you can use LOOP_BEGIN
and LOOP_END
, which works just like a for-loop:
LOOP_BEGIN 3
STRING Hello
DELAY 1000
STRINGLN World!
LOOP_END
Importsโ
With IMPORT
, You can start running another script from within a script! This is particularly useful if you want to split your script into multiple files for better readability - instead of having one gigantic script.
IMPORT second_script.txt
LEDโ
Control the onboard LED with the LED
function.
You can either set the color (R
, G
, or B
) and mode (SOLID
, SLOW
, FAST
, or OFF
) like this:
LED R SOLID
LED G SLOW
LED B FAST
Or you can set a specific RGB color value (0-255) like this:
LED 42 13 37
And optionally, you can also set a blink interval in milliseconds (r,g,b, blink):
LED 42 13 37 500
Custom Keycodesโ
The KEYCODE
function sends specified keycodes to the target computer. You can use it to press any key or combination possible.
This is particularly useful if a key is not specified in the script language.
This example presses shift and a, resulting in an "A":
KEYCODE 0x02 0x04
The first argument specifies the modifiers (like shift, ctrl, or alt). The second argument is a key; you can specify up to 6 keys.
Values can be in decimal or hexadecimal:
KEYCODE modifier key1 [key2] [key3] [key4] [key5] [key6]