# mazt08/mazcro architecture

> Architecture diagram of the GitHub repository mazt08/mazcro, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mazt08/mazcro
- Repository: https://github.com/mazt08/mazcro

## Overview

MazCro is a Windows-oriented GUI macro recorder and player. The main workflow is to select a target application, record or manually assemble actions, save or load a macro, then validate and replay it against a matching window. The UI also supports coordinate picking, variables, hotkeys, and Alt+Tab auto-triggering. The source excerpts establish the core model, persistence, recording, playback, picker, and window-detection layers; some additional UI wiring and capabilities are documented only in the README.

Main entry points: [`main.py`](https://github.com/mazt08/mazcro/blob/main/main.py) (Macro GUI), [`player.py`](https://github.com/mazt08/mazcro/blob/main/player.py) (Playback engine), [`window_manager.py`](https://github.com/mazt08/mazcro/blob/main/window_manager.py) (Window detection and matching), [`macro_model.py`](https://github.com/mazt08/mazcro/blob/main/macro_model.py) (Macro and action model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interface"]
  node_gui["Macro GUI<br/>[main.py]"]
end

subgraph group_authoring["Macro authoring"]
  node_action_editor["Action queue editor<br/>[main.py]"]
  node_coordinate_picker["Coordinate picker"]
  node_macro_model["Macro and action model<br/>[macro_model.py]"]
  node_recorder["Input recorder<br/>[recorder.py]"]
end

subgraph group_runtime["Playback and targeting"]
  node_player["Playback engine<br/>[player.py]"]
  node_window_manager["Window detection and matching<br/>[window_manager.py]"]
  node_input_hooks["Keyboard and mouse input hooks"]
  node_automation_backend["Input automation backend"]
end

subgraph group_persistence["Persistence"]
  node_macro_store["Macro file storage<br/>[macro_store.py]"]
  node_macro_files[("JSON macro files")]
  node_error_log[("Error log")]
end

node_user(("User"))
node_target_app["Target application"]
node_foreground_app["Foreground window"]

node_user -->|"uses"| node_gui
node_gui -->|"lists windows"| node_window_manager
node_gui -->|"edits actions"| node_action_editor
node_gui -->|"opens picker"| node_coordinate_picker
node_coordinate_picker -->|"returns coordinates"| node_gui
node_user -->|"provides activity"| node_recorder
node_recorder -->|"creates actions"| node_macro_model
node_gui -->|"controls recording"| node_recorder
node_action_editor -->|"edits macro actions"| node_macro_model
node_gui -->|"loads and saves"| node_macro_store
node_macro_store -->|"serializes models"| node_macro_model
node_macro_store -->|"reads and writes"| node_macro_files
node_macro_store -->|"writes logs"| node_error_log
node_gui -->|"starts playback"| node_player
node_player -->|"executes actions"| node_macro_model
node_player -->|"checks target"| node_window_manager
node_player -->|"sends input"| node_automation_backend
node_input_hooks -->|"supplies events"| node_recorder
node_window_manager -->|"detects focus"| node_foreground_app
node_window_manager -->|"matches target"| node_macro_model
node_player -->|"replays actions"| node_target_app
node_gui -->|"triggers by hotkey"| node_player
node_window_manager -.->|"auto-triggers on focus"| node_player

click node_gui "https://github.com/mazt08/mazcro/blob/main/main.py"
click node_action_editor "https://github.com/mazt08/mazcro/blob/main/main.py"
click node_coordinate_picker "https://github.com/mazt08/mazcro/blob/main/coordinate_picker.py"
click node_macro_model "https://github.com/mazt08/mazcro/blob/main/macro_model.py"
click node_recorder "https://github.com/mazt08/mazcro/blob/main/recorder.py"
click node_macro_store "https://github.com/mazt08/mazcro/blob/main/macro_store.py"
click node_player "https://github.com/mazt08/mazcro/blob/main/player.py"
click node_window_manager "https://github.com/mazt08/mazcro/blob/main/window_manager.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_gui,node_user toneBlue
class node_action_editor,node_coordinate_picker,node_macro_model,node_recorder toneAmber
class node_player,node_window_manager,node_input_hooks,node_automation_backend toneMint
class node_macro_store,node_macro_files,node_error_log toneRose
class node_target_app,node_foreground_app toneIndigo
```

## Components

### User interface

- [Macro GUI](https://github.com/mazt08/mazcro/blob/main/main.py): `main.py`

### Macro authoring

- [Action queue editor](https://github.com/mazt08/mazcro/blob/main/main.py): `main.py`
- [Coordinate picker](https://github.com/mazt08/mazcro/blob/main/coordinate_picker.py): `coordinate_picker.py`
- [Macro and action model](https://github.com/mazt08/mazcro/blob/main/macro_model.py): `macro_model.py`
- [Input recorder](https://github.com/mazt08/mazcro/blob/main/recorder.py): `recorder.py`

### Playback and targeting

- [Playback engine](https://github.com/mazt08/mazcro/blob/main/player.py): `player.py`
- [Window detection and matching](https://github.com/mazt08/mazcro/blob/main/window_manager.py): `window_manager.py`
- **Keyboard and mouse input hooks**
- **Input automation backend**

### Persistence

- [Macro file storage](https://github.com/mazt08/mazcro/blob/main/macro_store.py): `macro_store.py`
- **JSON macro files**
- **Error log**

### Other components

- **User**
- **Target application**
- **Foreground window**

## Connections

- User → Macro GUI: uses (evidence: `README.md`)
- Macro GUI → Window detection and matching: lists windows (evidence: `main.py`)
- Macro GUI → Action queue editor: edits actions (evidence: `README.md`)
- Macro GUI → Coordinate picker: opens picker (evidence: `main.py`)
- Coordinate picker → Macro GUI: returns coordinates (evidence: `coordinate_picker.py`)
- User → Input recorder: provides activity (evidence: `README.md`)
- Input recorder → Macro and action model: creates actions (evidence: `recorder.py`)
- Macro GUI → Input recorder: controls recording (evidence: `README.md`)
- Action queue editor → Macro and action model: edits macro actions (evidence: `README.md`)
- Macro GUI → Macro file storage: loads and saves (evidence: `main.py`)
- Macro file storage → Macro and action model: serializes models (evidence: `macro_store.py`)
- Macro file storage → JSON macro files: reads and writes (evidence: `macro_store.py`)
- Macro file storage → Error log: writes logs (evidence: `macro_store.py`)
- Macro GUI → Playback engine: starts playback (evidence: `README.md`)
- Playback engine → Macro and action model: executes actions (evidence: `player.py`)
- Playback engine → Window detection and matching: checks target (evidence: `README.md`)
- Playback engine → Input automation backend: sends input (evidence: `README.md`)
- Keyboard and mouse input hooks → Input recorder: supplies events (evidence: `recorder.py`)
- Window detection and matching → Foreground window: detects focus (evidence: `window_manager.py`)
- Window detection and matching → Macro and action model: matches target (evidence: `window_manager.py`)
- Playback engine → Target application: replays actions (evidence: `README.md`)
- Macro GUI → Playback engine: triggers by hotkey (evidence: `README.md`)
- Window detection and matching → Playback engine: auto-triggers on focus (evidence: `README.md`)
