Added updated macro syntax documentation; Added delete key to macro

engine.
This commit is contained in:
eworc778 2025-08-25 21:46:05 +01:00
parent d31242ed6c
commit 470b4c2333
3 changed files with 303 additions and 0 deletions

58
kico-macro-syntax.md Normal file
View File

@ -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.
- "\<string>": 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 "\<string>": Displays a string on the top line of the LCD.
- WAIT \<duration>: 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.

View File

@ -610,6 +610,17 @@ def macro_parser(macroFileName=(str)):
time.sleep(0.1) time.sleep(0.1)
kbd.send(Keycode.RIGHT_ARROW) 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": elif line == "forwardslash":
if holdingKeys == 1: if holdingKeys == 1:

View File

@ -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
""<string>": 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 "<string>": Displays a string on the top line of the LCD."
enter
enter
"WAIT <duration>: 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."