Caution
WORK IN PROGRESS: The scripting engine and .mps format are currently under active development. Some features described below may be partially implemented or unavailable in the current release.
MacroPad Script (.mps) elevates simple recordings into dynamic automation workflows. The scripting engine is built for reliability, providing Turing-complete logic without the overhead of a full general-purpose runtime.
Use the let keyword to define or update variables. Variable names MUST start with a $.
let $val = 10
let $status = "initial"
The delay command pauses execution for a specified duration.
delay 500ms
delay 2s
The run command invokes an .mpr recording as a component of the script.
By default, the run command is blocking. The script will wait until the macro finishes before moving to the next line. This prevents overlapping commands and ensures predictable timing.
run "C:\macros\login.mpr"
run "C:\macros\do_work.mpr"
If you need to fire a macro and continue immediately, use run_async.
run_async "C:\macros\background_task.mpr"
delay 500ms
Standard branching based on system state or pixel evaluation.
if true {
let $result = "pass"
} else {
let $result = "fail"
}
Execute a block of code multiple times.
loop (5) {
run "C:\macros\click_item.mpr"
delay 100ms
}
The lexer is optimized for Windows file systems, supporting raw strings for robust path handling.
run r"C:\Users\Name\Documents\Macro.mpr"
The following variables are available by default in every script:
$date: Current date (YYYY-MM-DD)$time: Current time (HH:MM:SS)$username: Current OS user.$home: User's home directory.
MacroPad includes a dedicated integration test suite to verify script logic. See the tests/ directory for examples of automated verification for variable scoping and control flow.