From 470b4c2333db45944bee45ae961fa599522b815f Mon Sep 17 00:00:00 2001 From: eworc778 Date: Mon, 25 Aug 2025 21:46:05 +0100 Subject: [PATCH] Added updated macro syntax documentation; Added delete key to macro engine. --- kico-macro-syntax.md | 58 +++++++++++ src/code.py | 11 ++ src/macros/syntax.mcr | 234 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 303 insertions(+) create mode 100644 kico-macro-syntax.md diff --git a/kico-macro-syntax.md b/kico-macro-syntax.md new file mode 100644 index 0000000..9e01a22 --- /dev/null +++ b/kico-macro-syntax.md @@ -0,0 +1,58 @@ +Kico macro file syntax: + +> Macro files must be placed in the 'macros' folder in the pico's internal storage. +> Macro files must be saved as '.mcr' files. + +The Kico is capable of typing most characters. + +Each line in the file is read as a single instruction. + +- "\": Types out the string inside the quotes. Allows most characters, exluding '\\' and '/' + +- #: Used at the start of a line to mark a it as a comment. Comments are not executed, but are still displayed. + +- LCD_SHOW "\": Displays a string on the top line of the LCD. + +- WAIT \: Pauses execution for the specified interval. Accepts either an integer or a float. + +- HOLD: Starts reading up to 6 of the next keys as a combination. + +- RELEASE: Releases a held combination of up to 6 keys. + +## Key aliases: + +> Aliases must be entered on their own line, without quotes. + +- super: Key commonly marked as with a Windows Icon on most keyboards. + +- windows: Key commonly marked as Windows Icon on most keyboards. + +- enter: Enter key, sometimes marked as return. Mainly used for newlines. + +- escape: Key commonly marked as "Esc" on most keyboards. + +- tab: A tab character.f<1-24>: Function keys one through 24. + +- ctrl: Left control key. + +- shift: Left shift key. Can be used in hold combinations to capitalise a specific key. + +- downarrow: Down arrow key. + +- uparrow: Up arrow key. + +- leftarrow: Left arrow key. + +- rightarrow: Right arrow key. + +- space: A space character (" "). + +- capslock: Caps lock key, is toggled when sent. + +- delete: Delete key. + +- forwardslash: A "/" character. + +- backslash: A "\\" character. + +- backspace: The backspace key. \ No newline at end of file diff --git a/src/code.py b/src/code.py index 1f9a26a..3d722d5 100644 --- a/src/code.py +++ b/src/code.py @@ -610,6 +610,17 @@ def macro_parser(macroFileName=(str)): time.sleep(0.1) kbd.send(Keycode.RIGHT_ARROW) + + elif line == "delete": + if holdingKeys == 1: + + keysToPress.append(Keycode.DELETE) + + else: + + time.sleep(0.1) + + kbd.send(Keycode.DELETE) elif line == "forwardslash": if holdingKeys == 1: diff --git a/src/macros/syntax.mcr b/src/macros/syntax.mcr index e69de29..7a7bd72 100644 --- a/src/macros/syntax.mcr +++ b/src/macros/syntax.mcr @@ -0,0 +1,234 @@ + +# The following combination presumes you're using some form of dmenu. + +HOLD + +super + +"d" + +RELEASE + +# Wait for slower machines + +#WAIT 1.5 + +"text editor" + +enter + +#WAIT 1.5 + +# Open a new file + +HOLD + +ctrl + +"n" + +RELEASE + +WAIT 0.5 + +# Start typing syntax + +"Kico macro file syntax:" + +enter + +enter + +"> Macro files must be placed in the 'macros' folder in the pico's internal storage." + +enter + +"> Macro files must be saved as '.mcr' files." + +enter + +enter + +"The Kico is capable of typing most characters." + +enter + +enter + +"Each line in the file is read as a single instruction." + +enter + +enter + +"Typing standard text:" + +enter + +""": Types out the string inside the quotes. Allows most characters, exluding '" + +backslash + +"' and '" + +forwardslash + +"'" + +enter + +enter + +"#: Used at the start of a line to mark a it as a comment. Comments are not executed, but are still displayed." + +enter + +enter + +"LCD_SHOW "": Displays a string on the top line of the LCD." + +enter + +enter + +"WAIT : Pauses execution for the specified interval. Accepts either an integer or a float." + +enter + +enter + +"HOLD: Starts reading up to 6 of the next keys as a combination." + +enter + +enter + +"RELEASE: Releases a held combination of up to 6 keys." + +enter + +enter + +"Key aliases:" + +enter + +enter + +"> Aliases must be entered on their own line, without quotes." + +enter + +enter + +"super: Key commonly marked as with a Windows Icon on most keyboards." + +enter + +enter + +"windows: Key commonly marked as Windows Icon on most keyboards." + +enter + +enter + +"enter: Enter key, sometimes marked as return. Mainly used for newlines." + +enter + +enter + +"escape: Key commonly marked as "Esc" on most keyboards." + +enter + +enter + +"tab: A tab character." + +enter + +enter + +"f<1-24>: Function keys one through 24." + +enter + +enter + +"ctrl: Left control key." + +enter + +enter + +"shift: Left shift key. Can be used in hold combinations to capitalise a specific key." + +enter + +enter + +"downarrow: Down arrow key." + +enter + +enter + +"uparrow: Up arrow key." + +enter + +enter + +"leftarrow: Left arrow key." + +enter + +enter + +"rightarrow: Right arrow key." + +enter + +enter + +"space: A space character (" ")." + +enter + +enter + +"capslock: Caps lock key, is toggled when sent." + +enter + +enter + +"delete: Delete key." + +enter + +enter + +"forwardslash: A "" + +forwardslash + +"" character." + +enter + +enter + +"backslash: A "" + +backslash + +"" character." + +enter + +enter + +"backspace: The backspace key."