Documentation

Instant Macro

Instant Macro is a feature that records keyboard input strings and control key operations in real time on the spot, allowing fast, one-key playback from a registered extended key....

Instant Macro is a feature that records keyboard input strings and control key operations in real time on the spot, allowing fast, one-key playback from a registered extended key.


Basic Operation

Macro recording and playback are performed through the following two special commands assigned to key extension mappings (in the default mapping, . on L1 is playback, and . on SS is the recording toggle):

  1. {Macro} (Toggle Macro Recording Start / Stop):
    • When executed while the macro is stopped (idle), it clears the previous recording memory and starts a new recording.
    • During recording, a character indicating that a macro is being recorded (default "M", color "FF00FF") is composited and displayed next to the caret indicator.
    • Running {Macro} again during recording saves the input up to that point and completes (commits) the recording. The indicator display returns to normal.
  2. {ExecuteMacro} (Play Macro):
    • Plays back and executes the recorded macro all at once on the spot.

Accurate Recording and Misoperation Prevention Technology

To prevent keystroke timing deviations and modifier key conflicts, the following advanced control logic is implemented:

1. OnChar Hook-Based Character Recording

Instead of recording physical keystroke keys (scan codes, etc.) directly, the actual “characters” output on Windows are accurately buffered using the OnChar API hook. This allows the text to be recorded exactly as it appears, regardless of the IME on/off status or the state of modifier key applications.

2. Chattering and Duplicate Input Prevention

To guard against duplicate recording caused by chattering or double hooking of the same key, consecutive inputs of the same key within 150 ms are automatically ignored.

3. Key Transmission Protection and Text Mode During Playback

When transmitting single-character text data, it is sent using SendEvent("{Text}" key). This prevents erroneous inputs caused by the IME state or modifier key leakage during playback.

4. Conflict Blocking During Macro Playback

  • Physical Space Key Evacuation: If the Space key (Space Shift) is physically pressed down during playback, a logical Space Up is temporarily sent to avoid conflicts and safely inject characters. The moment playback is complete, it automatically returns to the original Space Down state.
  • Temporary Suspension of Hooks: While the playback process is running, hooks such as the modifier key lock hook (LockInputHook) are temporarily suspended (Stop/Start) to prevent the macro’s own transmitted keys from being hooked and causing malfunction.
  • Double Output Guard: To prevent loops where keys within the transmitted macro are hooked again (causing “a macro to be recorded inside a macro”), an asynchronous delay guard is applied using the sending guard flag (IsSendingKey) and a cooldown between key transmissions (LastSendTime).