# Macros

Venabili lets you define keys that automatically press multiple keys in sequence for you (a "macro"). This could be used to perform a sequence of key presses that you normally do over and over again by hand, or to store commonly used text strings like passwords, phone number, email addresses, etc.

## Defining macros

Macros are defined in the `venabili.c` file as arrays of keys.

Take a look at this macro that will do `Ctrl + c` and `Ctrl + v` on a single keystroke:

```c
Macro m1 = { Rctrl(k_c), Rctrl(k_v), k_empty };
```

After you've defined some macros you need to register them with the `add_macro(name)` function like so:

```c
// Macro m0 = ...
// Macro m1 = ...

add_macro(m0);
add_macro(m1);
```

If you need a macro that only consists of text strings, use the `add_string_macro` instead:

```c
add_string_macro("email@example.com");
add_string_macro("08764208");
add_string_macro("Some street in some avenue");
add_string_macro("This@is_n0t_a_pa$$word");
```

Each macro you register will acquire an identifier that increments from 0.

Once you're happy with your macros, make sure to set the `N_MACROS` number in the `config.h` file to match the number of macros you have registered.

## Using macros

In order to trigger macros, use the `MACRO(id)` key in your layers, where *id* is the number of the macro you want to use.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.venabili.sillybytes.net/customizing/macros.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
