From f21fa5edb73680370317279dc43dae47127cd6a6 Mon Sep 17 00:00:00 2001 From: chemicalwill <36576135+chemicalwill@users.noreply.github.com> Date: Mon, 6 Jun 2022 14:29:01 -0500 Subject: [PATCH] Added KC.MACRO_SLEEP_MS(ms) example * provided an example of KC.MACRO_SLEEP_MS(ms) within sequences.md --- docs/sequences.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/docs/sequences.md b/docs/sequences.md index d495b0f..26b5a8b 100644 --- a/docs/sequences.md +++ b/docs/sequences.md @@ -54,6 +54,42 @@ keyboard.keymap = [...PASTE_WITH_COMMENTARY,...] The above example will type out "look at this: " and then paste the contents of your clipboard. + +### Sleeping within a sequence + +If you need to wait during a sequence, you can use `KC.MACRO_SLEEP_MS(ms)` to wait a +length of time, in milliseconds. + +```python +from kmk.handlers.sequences import simple_key_sequence + +COUNTDOWN_TO_PASTE = simple_key_sequence( + ( + KC.N3, + KC.ENTER, + KC.MACRO_SLEEP_MS(1000), + KC.N2, + KC.ENTER, + KC.MACRO_SLEEP_MS(1000), + KC.N1, + KC.ENTER, + KC.MACRO_SLEEP(1000), + KC.LCTL(KC.V), + ) +) + +keyboard.keymap = [...COUNTDOWN_TO_PASTE,...] +``` + +This example will type out the following, waiting one second (1000 ms) between numbers: + + 3 + 2 + 1 + +and then paste the contents of your clipboard. + + ## Unicode Before trying to send Unicode sequences, make sure you set your `UnicodeMode`. You can set an initial value in your keymap by setting `keyboard.unicode_mode`.