diff options
author | Jack Humbert <jack.humb@gmail.com> | 2017-05-29 11:58:08 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-29 11:58:08 -0400 |
commit | 1d6a18db99a91b059798a11a7820424d9b7c7b0c (patch) | |
tree | 7b708f1e8a36c473d41708052b167ed2350083a8 | |
parent | cecf783e145c4ca8e7737e8a1909bce946bc5a0f (diff) | |
parent | 91c6113cbabe01680d3dd473f8db64afaeec0bf6 (diff) |
Merge pull request #1343 from Maartenwut/patch-1
Added SEND_STRING(); to the documentation.
-rw-r--r-- | docs/Macros.md | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/docs/Macros.md b/docs/Macros.md index 78290bbf69..994d01928f 100644 --- a/docs/Macros.md +++ b/docs/Macros.md @@ -195,3 +195,21 @@ For users of the earlier versions of dynamic macros: It is still possible to fin If the LED-s start blinking during the recording with each keypress, it means there is no more space for the macro in the macro buffer. To fit the macro in, either make the other macro shorter (they share the same buffer) or increase the buffer size by setting the `DYNAMIC_MACRO_SIZE` preprocessor macro (default value: 128; please read the comments for it in the header). For the details about the internals of the dynamic macros, please read the comments in the `dynamic_macro.h` header. + +# Sending strings +Some people want to have a password or some text on a key. This is possible without having to do every key individually using `SEND_STRING("<text>");`. Note the caps, because `send_string("<text>");` does something else. For example: +```c +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) // this is the function signature -- just copy/paste it into your keymap file as it is. +{ + switch(id) { + case 0: // this would trigger when you hit a key mapped as M(0) + if (record->event.pressed) { + SEND_STRING("QMK is the best thing ever!"); // This would type "QMK is the best thing ever!" (without quotation marks). + return false; // This is false because it has to return something. + } + break; + } + return MACRO_NONE; +}; +``` +If you'd want it to press enter as well, just replace `return false;` with `return MACRO( T(ENT), END );`. |