zeplar-exe / MacroMat

A modern macro and hotkey creation library.
https://zeplar-exe.github.io/MacroMat/
MIT License
0 stars 0 forks source link
macro

MacroMat

MacroMat is a modern macro and hotkey creation library built with BakedEnv to expand upon AutoHotKey's syntax and features.

Features.

Getting Started & Documentation

C# Library

Installation

The C# library is be available on nuget.

Usage

The library's functionality is primarily exposed via the Macro class, which is necessary in order to, well, macro (as a verb).

using MacroMat;

Macro macro = new Macro();
macro.EnqueueInstruction(...);

bool success = macro.ExecuteNext();

// [...]

Instructions are the building blocks of a macro. By default, several cross-platform instructions are available in the MacroMat.Instructions namespace; SimulateKeyboardInstruction, SimulateMouseInstruction, SendUnicodeInstruction, KeyCallbackInstruction, and more.

// [...]

var pressA = new SimulateKeyboardInstruction(KeyInputData.FromKey(InputKey.A, KeyInputType.KeyDown));
var releaseA = new SimulateKeyboardInstruction(KeyInputData.FromKey(InputKey.A, KeyInputType.KeyUp));

macro.EnqueueInstruction(pressA)
     .EnqueueInstruction(releaseA);

macro.ExecuteAll();

For convenience, several extension methods are available for common operations.

using MacroMat.Extensions;

// [...]

macro.SimulateUnicode("Unicode, UTF-8, or is it UTF-16?")
     .Wait(1000)
     .Action(() => Console.WriteLine("Checkpoint."))
     .Wait(500)
     .SimulateInput(KeyInputData.FromKey(InputKey.Backspace, KeyInputType.KeyDown))
     .Wait(5000); // Hold down backspace for 5 seocnds
     .SimulateInput(KeyInputData.FromKey(InputKey.Backspace, KeyInputType.KeyUp))

See the documentation for in-depth information.