Skip to content

Latest commit

ย 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

โšก Macro Manager System

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.


๐ŸŽฅ Demo

Watch the application in action:

Watch Demo on LinkedIn

The demo shows the Macro Manager interface, macro creation flow, keyboard-triggered execution, and automation behavior.


โœจ Key Features

โŒจ๏ธ Global Hotkey Detection

Macros can be assigned to global keyboard triggers including:

  • F1 โ€“ F12
  • 0 โ€“ 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.


โšก Automated Macro Actions

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.


๐Ÿ” Repeat Execution

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.


๐Ÿ›‘ Emergency Stop System

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.


๐Ÿงต Background Execution

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.


๐Ÿ’พ Persistent Macro Storage

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.


๐Ÿ–ฅ๏ธ Desktop GUI

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

๐Ÿ“Œ System Tray Integration

The application also supports system tray integration, allowing Macro Manager to remain available while operating in the background.


๐Ÿ› ๏ธ Tech Stack

Core Technologies

  • 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

๐Ÿ—๏ธ System Architecture

                 User
                   โ”‚
                   โ–ผ
           Java Swing Interface
                   โ”‚
          โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
          โ–ผ                 โ–ผ
    Create Macro       Manage Macros
          โ”‚
          โ–ผ
     Macro Storage
      macros.json
          โ”‚
          โ–ผ
      JNativeHook
  Global Key Listener
          โ”‚
          โ–ผ
       Macro Engine
          โ”‚
     โ”Œโ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”
     โ–ผ          โ–ผ
 Type Text   Launch App
     โ”‚
     โ–ผ
  Java Robot

๐Ÿ“‚ Project Structure

Macro-Manager-System/
โ”‚
โ”œโ”€โ”€ src/
โ”‚   โ””โ”€โ”€ main/
โ”‚       โ””โ”€โ”€ java/
โ”‚           โ”œโ”€โ”€ MacroAppFrame.java
โ”‚           โ”œโ”€โ”€ CreateMacroDialog.java
โ”‚           โ”œโ”€โ”€ ManageMacrosDialog.java
โ”‚           โ””โ”€โ”€ MacroAction.java
โ”‚
โ”œโ”€โ”€ macros.json
โ”œโ”€โ”€ pom.xml
โ””โ”€โ”€ README.md

๐Ÿงฉ Main Components

MacroAppFrame.java

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

CreateMacroDialog.java

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

ManageMacrosDialog.java

Provides functionality for viewing and managing saved macros.


MacroAction.java

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.


โš™๏ธ How It Works

1. Create a Macro

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.


2. Global Keyboard Monitoring

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.


3. Execute the Macro

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.


4. Repeat Logic

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.


5. Emergency Stop

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.


๐Ÿš€ Getting Started

Prerequisites

Make sure the following are installed:

Java
Maven
Git

Clone the Repository

git clone https://github.com/Yadavrishi9500/Macro-Manager-System.git

Move into the project directory:

cd Macro-Manager-System

Install Dependencies

Run:

mvn clean install

Maven will automatically download the project dependencies.


๐Ÿ“ฆ Dependencies

The current project uses:

JNativeHook 2.2.2
Gson 2.10.1

JNativeHook

Used for detecting global keyboard input even when the application is not focused.

Gson

Used to save and load macro configurations from JSON.


๐Ÿ’ก Engineering Concepts Used

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

๐Ÿง  What I Learned

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.


๐Ÿ”ฎ Future Improvements

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

โš ๏ธ Usage Note

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.


๐Ÿ‘จโ€๐Ÿ’ป Author

Rishi Yadav

Software Development โ€ข AI โ€ข Computer Vision โ€ข Backend โ€ข Full-Stack Development


Automate repetitive work. Build smarter workflows.

About

Java desktop macro automation tool with global hotkeys, text/app actions, repeat execution, JSON persistence, and an emergency stop system.

Topics

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages