Documentation
Commands
Keyboard commands#
- Press Key: presses and releases a key. Set the hold time, how many times, and the gap between presses.
- Key Down: holds a key down until a Key Up for it (or until the routine ends).
- Key Up: releases a key that was held down.
- Type Text: types text one character at a time, with a delay per character. Use {VariableName} to type a variable's value.
To choose the key, click the Key box and press the key, for example A, Space, F1 or LeftShift. A Key box holds one key. For a combination such as Ctrl+C, use Key Down (LeftCtrl), Press Key (C), then Key Up (LeftCtrl).
Mouse commands#
- Move Mouse: moves the pointer to a position, or by an amount from where it is now (tick "Move relative to current position").
- Click Mouse: clicks Left, Right or Middle. Either where the pointer already is, or at a position. Set the number of clicks (2 = double-click) and the hold time.
- Mouse Button Down / Mouse Button Up: hold and release a button. With a Move Mouse in between, this drags.
- Scroll Wheel: positive notches scroll up, negative scroll down.
X and Y accept a number, a variable such as @FX, or maths such as {FX} + 5.
Position is relative to: Screen counts from the top-left of the screen. Window counts from the inside top-left corner of a window you choose, so the routine still works if the window moves.
Timing commands#
- Delay: waits a fixed number of milliseconds (1000 ms = 1 second). Random extra adds a random 0 to N ms each time, so timing is less robotic.
- Wait Until: pauses the routine until a condition becomes true. It reacts as soon as a variable changes. Timeout 0 means wait forever; otherwise choose whether to continue or stop the routine when it times out.
If, Else If, Else#
- If runs the commands below it only when its condition is true. Every If needs an End If.
- Else If checks another condition when everything above it was false.
- Else runs when every If / Else If above it was false.
A condition compares a variable with a value (or with another variable, written @Name). You can add a second condition joined with AND or OR. See "Conditions and comparisons" for the details.

Loops#
- Loop repeats the commands up to End Loop: a number of times, Forever, While a condition is true, or Until it becomes true. While and Until check the condition before every pass.
- Exit Loop leaves the innermost loop immediately.
Labels and Go To#
- Label marks a place in the routine.
- Go To Label jumps to a Label in the same routine.
Variable commands#
- Set Variable: sets a variable to a value, to another variable (@Name), or to the answer of some maths for number variables, such as {Health} * 2 + 5. For Text variables, {Name} inside the value is replaced by that variable's value.
- Change Variable: Add, Subtract, Multiply, Divide, Toggle (Boolean variables only) or Append (adds text to the end).
- Random Number: puts a random number between Min and Max (both included) into a variable. Untick "Whole numbers only" for decimals.
If the maths cannot be worked out (for example dividing by zero), the variable is left unchanged and a warning is logged.
Alert command#
Alert gets your attention in one of four ways:
- Sound: a Windows sound (Beep, Asterisk, Exclamation, Hand, Question) or your own .wav file.
- Pop-up message: a message box. It can pause the routine until you click OK.
- Windows notification: a notification from the MacroFoundry tray icon.
- Notification + sound: both.
Use {VariableName} in the message to include a value.
Window commands#
Every window command finds its window by Title contains, Title is exactly, or Program name (such as notepad.exe). You can pick an open window from the list or type.
- Bring Window to Front: restores it if minimized and makes it the active window, so keys and clicks go to it.
- Wait for Window: waits until a window opens. Choose a time to give up (0 = forever), whether to bring it to the front, and optionally a Boolean variable that is set to true if it appeared or false if waiting gave up.
- Move / Resize Window: moves it to Left/Top. Width or Height 0 keeps the current size.
- Minimize / Maximize / Close Window: also Restore. Close is like clicking its X.
- Send Keys to Window: presses a key or types text in a window without bringing it to the front.
- Click in Window: clicks inside a window without moving your real mouse or bringing it to the front. X and Y are measured from the inside top-left corner; open the window and use Pick position.
Send Keys to Window and Click in Window work with most normal programs, but many games ignore them. Click in Window needs the spot to be visible on screen (not covered by another window) for some programs. Both can target every matching window at once.
Screen commands: Find Color and Find Image#
- Find Color: searches an area for a colour (#RRGGBB) and saves where it was found in two Integer variables (X and Y). Tolerance 0 means the exact colour. Search from Top-left (first match reading left to right, top to bottom) or Center of area (the match closest to the middle).
- Find Image: looks for a picture (an icon, button or other on-screen element) and saves where its centre was found. Use Capture image or Browse for a .png, .bmp or .jpg. Transparent parts of a PNG are ignored. Color tolerance is how much each pixel may differ; Allowed different pixels (%) lets things that change a little still match.
For both: Width or Height 0 searches the whole screen (a smaller area is much faster). X and Y are set to -1 when nothing is found. An optional Found? Boolean variable is set to true or false; use it with If.

Monitor commands#
- Pixel Monitor On/Off and Memory Monitor On/Off turn a monitor (or All) on or off.
When a monitor is turned on it checks straight away, so its variable is ready for the next command. Monitors are only turned on by these commands (or their hotkeys).
Program commands#
- Launch Program: starts a program (.exe), a shortcut (.lnk) or another file, as if you double-clicked it. Optional arguments. Can wait until it closes.
- Terminate Program: closes every running copy of a program. Browse to it or type its name, like notepad.exe. Close normally is like clicking X (the program may ask to save). Close, force after 5 seconds asks first, then forces. Force close now ends it at once; unsaved work is lost.
File and folder commands#
Paths are typed in full, for example C:\Reports\today.txt. Use {VariableName} to build part of a path from a variable, such as {Folder}\report.txt. If something goes wrong (a file is missing or already there), the routine writes a warning in the log and carries on.
- Copy File or Folder: copies a file or a whole folder. For a file, Copy to can be a full path or an existing folder to copy into. For a folder, Copy to is the path of the new copy. Missing folders in the destination are created.
- Move File or Folder: works the same way but moves instead of copying. A folder can only move to a path that does not exist yet.
- Replace if it already exists: off by default, so Copy and Move never overwrite a file unless you tick it.
- Rename File or Folder: gives a file or folder a new name in the same folder. Type just the new name, like report-2026.txt.
- Delete File or Folder: deletes permanently. Items do not go to the Recycle Bin and cannot be restored, and a folder is deleted with everything in it.
- Create Folder: creates a folder and any missing folders above it. If it already exists, nothing happens.
- Check File or Folder Exists: saves true or false in a Boolean variable, so an If can act on it.
Spreadsheet (CSV) commands#
MacroFoundry reads spreadsheets saved as CSV. In Excel use File > Save As and pick CSV; in Google Sheets use File > Download > CSV. It does not read .xlsx files directly.
- Count CSV Rows: counts the rows of data and saves the number in an Integer variable. Blank rows are not counted, and neither is the column-name row when First row has column names is ticked.
- Read CSV Row: reads one row and puts its values into variables. Row 1 is the first row of data; it can be a number, @Row or maths. List the variables in Save in variables, separated by commas, for example Name, Amount, Date. The first column goes into the first variable, and so on.
- Columns (optional): to read different columns, list them in the same order as the variables, by number (3, 1) or by column name (Amount, Name).
- Row found? (optional): a Boolean variable that is false when the file has fewer rows, instead of a warning.
- Number variables accept values like $1,234.50, 45% and (15), which counts as -15. Text variables keep the value exactly.
- Separator: Auto works for nearly every file. Pick Semicolon or Tab if a file uses those.
Other commands#
- Log Message: writes a message to the Execution Log. Use {VariableName} to include a value.
- Comment: a note for yourself. Does nothing when run.