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

๐Ÿ‘‡ More functions below

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 LayoutNote
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
Croatia ๐Ÿ‡ญ๐Ÿ‡ทHRHR_MACSince v1.2.1
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_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]

Made with โค๏ธ by

Spacehuhn

dev f82a457e