A lightweight Java desktop automation application that allows users to create, manage, and execute keyboard-triggered macros for repetitive tasks.
Macro Manager runs in the background, listens for global hotkeys, and performs predefined actions such as automatically typing text or launching applications.
The project focuses on desktop automation, global event handling, multithreading, persistent configuration, and safe execution control.
Watch the application in action:
The demo shows the Macro Manager interface, macro creation flow, keyboard-triggered execution, and automation behavior.
Macros can be assigned to global keyboard triggers including:
F1 – F120 – 9
The application uses JNativeHook to listen for keyboard events globally.
This allows a macro to trigger even when the Macro Manager window is not currently focused.
A macro can currently perform actions such as:
- Automatically typing predefined text
- Launching applications or executable files
- Repeating an action a selected number of times
- Running continuously using infinite-repeat mode
Text automation is performed using Java's AWT Robot API.
Each macro can be assigned a repeat count.
1 → Run once
5 → Run five times
100 → Run one hundred times
0 → Run continuously
This allows the application to automate repetitive workflows with minimal user interaction.
Continuous automation can become difficult to control if there is no safe stop mechanism.
Macro Manager includes an emergency kill-switch using Java's AtomicBoolean.
When a macro is currently executing, pressing its trigger key again stops the macro.
The execution state is checked continuously during automation, including while text is being typed.
This prevents long-running or infinite macros from becoming uncontrollable.
Macros execute on a background thread instead of the Swing event thread.
This keeps the desktop interface responsive while automation is running.
It also prevents long-running macros from freezing the application window.
Macros are stored locally in:
macros.json
The application uses Gson to serialize and deserialize macro configurations.
Saved macros are automatically loaded when the application starts again.
Macro Manager includes a Java Swing interface that lets users:
- Create new macros
- Manage existing macros
- Select a trigger key
- Choose the macro action
- Configure repeat count
- Save macro configurations
The application also supports system tray integration, allowing Macro Manager to remain available while operating in the background.
- Java
- Java Swing — desktop GUI
- Java AWT Robot — keyboard automation
- JNativeHook — global keyboard event detection
- Gson — JSON persistence
- Maven — dependency management
- Java Threads — asynchronous execution
- AtomicBoolean — thread-safe macro stop control
User
│
▼
Java Swing Interface
│
┌────────┴────────┐
▼ ▼
Create Macro Manage Macros
│
▼
Macro Storage
macros.json
│
▼
JNativeHook
Global Key Listener
│
▼
Macro Engine
│
┌────┴─────┐
▼ ▼
Type Text Launch App
│
▼
Java Robot
Macro-Manager-System/
│
├── src/
│ └── main/
│ └── java/
│ ├── MacroAppFrame.java
│ ├── CreateMacroDialog.java
│ ├── ManageMacrosDialog.java
│ └── MacroAction.java
│
├── macros.json
├── pom.xml
└── README.md
This is the main application window and execution engine.
It is responsible for:
- Loading saved macros
- Saving macro configurations
- Registering global keyboard listeners
- Detecting trigger keys
- Executing macro actions
- Running macros asynchronously
- Simulating keyboard input
- Starting external programs
- Handling the emergency stop system
- Managing system tray integration
This component provides the interface for creating a new macro.
Users can configure:
- Trigger key
- Action type
- Text or application path
- Repeat count
Currently supported actions include:
Type Text
Open Application
Provides functionality for viewing and managing saved macros.
Represents an individual action stored inside a macro.
Each action contains the information required by the execution engine to determine what should happen when the macro runs.
Open Macro Manager and select:
Create New Macro
Choose a trigger key, for example:
F6
Choose an action:
Type Text
Then enter the text you want to automate:
Hello from Macro Manager!
Select how many times the action should repeat and save the macro.
After startup, the application registers a global keyboard listener using JNativeHook.
This allows the application to detect configured trigger keys even when another application is active.
Press the configured trigger key.
Example:
F6
Macro Manager detects the key and launches the macro on a background thread.
If the action is configured to type text, the Java Robot API generates the corresponding keyboard events.
The macro engine reads the configured repeat value before executing the action.
For example:
Repeat Count = 5
will execute the action five times.
A repeat count of:
0
enables continuous execution.
If a macro is currently running, press its trigger key again.
The shared execution flag is changed immediately and the macro stops.
This makes continuous or long-running automation much safer to control.
Make sure the following are installed:
Java
Maven
Git
git clone https://github.com/Yadavrishi9500/Macro-Manager-System.gitMove into the project directory:
cd Macro-Manager-SystemRun:
mvn clean installMaven will automatically download the project dependencies.
The current project uses:
JNativeHook 2.2.2
Gson 2.10.1
Used for detecting global keyboard input even when the application is not focused.
Used to save and load macro configurations from JSON.
This project demonstrates several important software development concepts:
- Object-oriented programming
- Event-driven programming
- Desktop GUI development
- Global keyboard event handling
- Multithreading
- Thread-safe state control
- File persistence
- JSON serialization
- Process execution
- Keyboard simulation
- Maven dependency management
Building Macro Manager helped me go beyond basic Java applications and understand how desktop software interacts with the operating system.
Some of the areas I explored include:
- Designing event-driven desktop applications
- Handling global keyboard input
- Keeping Swing interfaces responsive
- Running automation in background threads
- Coordinating execution state safely
- Storing user-created configurations
- Simulating keyboard actions programmatically
- Launching external processes
- Managing third-party dependencies with Maven
One of the most important engineering challenges was handling continuous macro execution safely.
Instead of allowing an infinite loop to block the program, the macro engine runs on a background thread and checks a shared thread-safe flag.
This allows the user to stop execution at any time through the emergency hotkey behavior.
Possible improvements for future versions include:
- Multiple actions inside a single macro
- Mouse click automation
- Mouse movement automation
- Macro recording
- Keyboard sequence recording
- Custom delays between actions
- Macro editing
- Hotkey combinations such as
Ctrl + Shift + K - Better system tray controls
- Import/export macro profiles
- Improved interface design
- Cross-platform testing
- Executable packaging
- Macro categories and profiles
Macro Manager performs automated keyboard input and can launch external applications.
Use automation responsibly and test macros carefully before assigning them to important shortcuts.
For macros configured with continuous execution, make sure you understand how the emergency stop mechanism works before running them.
Rishi Yadav
Software Development • AI • Computer Vision • Backend • Full-Stack Development
Automate repetitive work. Build smarter workflows.