Skip to main content

Functions

Main Functions

CommandExampleDescription
# or REM# Hello World!Comment
DEFAULTDELAY or DEFAULT_DELAYDEFAULTDELAY 200Time in milliseconds between every command
DELAYDELAY 1000Delay in milliseconds
STRINGSTRING Hello World!Types the following text
STRINGLNSTRINGLN Hello World!Like STRING but presses enter at the end
REPEAT or REPLAYREPEAT 3Repeats the previous line n times

Keyboard Layout

tip

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

RegionStandard LayoutMac Layout
Belgium 🇧🇪BEBE_MAC
Bulgaria 🇧🇬BGBG_MAC
Canada 🇨🇦CA-CM, CA-FRCA-FR_MAC
Switzerland 🇨🇭CH-DE, CH-FRCH-DE_MAC, CH-FR_MAC
Czech Republic 🇨🇿CZCZ_MAC
Germany 🇩🇪DEDE_MAC
Denmark 🇩🇰DKDK_MAC
Estonia 🇪🇪EEEE_MAC
Spain 🇪🇸ESES_MAC
Latin-America 🌎ES-LAES-LA_MAC
Finland 🇫🇮FIFI_MAC
France 🇫🇷FRFR_MAC
United Kingdom 🇬🇧GBGB_MAC
Greece 🇬🇷GRGR_MAC
Hungary 🇭🇺HUHU_MAC
Ireland 🇮🇪IE-
India 🇮🇳ININ_MAC
Iceland 🇮🇸ISIS_MAC
Italy 🇮🇹ITIT_MAC
Latvia 🇱🇻LTLT_MAC
Lithuania 🇱🇹LVLV_MAC
Netherlands 🇳🇱NLNL_MAC
Norway 🇳🇴NONO_MAC
Poland 🇵🇱PLPL_MAC
Brazil 🇧🇷PT-BRPT-BR_MAC
Portugal 🇵🇹PTPT_MAC
Romania 🇷🇴RORO_MAC
Russia 🇷🇺RURU_MAC
Sweden 🇸🇪SESE_MAC
Slovenia 🇸🇮SISI_MAC
Slovakia 🇸🇰SKSK_MAC
Turkey 🇹🇷TRTR_MAC
Ukraine 🇺🇦UAUA_MAC
United States 🇺🇸USUS_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_START and LSTRING_STOP. Everything between those two commands, including linebreaks, gets typed out:

LSTRING_START
The quick brown
fox jumps over
the lazy dog
LSTRING_STOP

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]

Made with ❤️ by

Spacehuhn

dev 9fbbf84a