1
1
# Macro
2
2
3
- To setup a macro, add a macro to the keymap and define its function. For example, use <kbd >Fn</kbd > as No.0 macro:
3
+ To set up a macro, add a macro to the keymap and define its function. By default, <kbd >Fn</kbd > is configured as macro number 0 :
4
4
5
5
``` python
6
6
# code.py
@@ -27,9 +27,11 @@ keyboard.macro_handler = macro_handler
27
27
keyboard.run()
28
28
```
29
29
30
- ## Use a macro to launch the Calculator on Windows
30
+ ## Examples
31
31
32
- Replace the function ` macro_handler ` with the following code to launch the Calculator with a single keystroke.
32
+ ### Use a macro to launch the Calculator on Windows
33
+
34
+ Replace the function ` macro_handler ` with the following code to launch the Calculator with a single keystroke:
33
35
34
36
``` python
35
37
def macro_handler (dev , n , is_down ):
@@ -39,9 +41,9 @@ def macro_handler(dev, n, is_down):
39
41
dev.send_text(' calc\n ' )
40
42
```
41
43
42
- ## Automatic typing
44
+ ### Automatic typing
43
45
44
- Read a file in the USB storage and type its content automatically.
46
+ Read a file in the keyboard's USB storage and type its content automatically.
45
47
46
48
``` python
47
49
def macro_handler (dev , n , is_down ):
@@ -51,9 +53,9 @@ def macro_handler(dev, n, is_down):
51
53
dev.send_text(line)
52
54
```
53
55
54
- ## Repeated typing
56
+ ### Repeated typing
55
57
56
- Use a macro to trigger a repeated sequence of typing until a new key is pressed.
58
+ Use a macro to trigger a repeated sequence of key presses until a new key is pressed.
57
59
58
60
``` python
59
61
def macro_handler (dev , n , is_down ):
0 commit comments