Documentation

How do I...?

Click a button wherever it appears on screen#

  1. Create two Integer variables, for example BX and BY, and a Boolean variable Found.
  2. Add Find Image, click Capture image and drag a box around the button. Save X in BX, Y in BY, Found? in Found.
  3. Add If Found == true, then Click Mouse with "Click where the pointer already is" unticked, X = @BX and Y = @BY, then End If.

React when health gets low#

  1. Create a Boolean variable, for example LowHealth.
  2. Make a pixel monitor on the health bar with the bar's colour. Set Result is true when to Absent, and Write to variable LowHealth.
  3. Add an If true action: Start routine, your healing routine.
  4. In your main routine, add Pixel Monitor On/Off to turn it on.

With a memory monitor instead, use Condition mode, for example < 300.

Repeat something with random timing#

Use Loop (Count or Forever), put your commands inside, and add a Delay with Random extra set, for example 500 ms + up to 300 ms random. End with End Loop. Press F9 or Pause to stop a Forever loop.

Run a routine every half hour#

Select the routine, click Schedule, tick Start this routine automatically, set At to the first time, and set Then repeat every (min) to 30. Keep MacroFoundry open (Minimize to tray helps).

Open a program and arrange its window#

Launch Program (the .exe), then Wait for Window (part of its title, with Bring it to the front ticked), then Move / Resize Window.

Type into a window while you use another one#

Use Send Keys to Window with Send set to Type text. It works with most normal programs; many games ignore it, and then you need Bring Window to Front and Type Text instead.

Get told when something happens#

Make a pixel or memory monitor that notices it, and give it an If true action that starts a small routine with an Alert (for example Notification + sound).

Keep a record in a text file#

Use the Write Line to File command from the sample plugin, with {VariableName} in the line to include values. The Execution Log is also saved daily in the logs folder.

Tidy up files after a routine#

Use Check File or Folder Exists to see whether a file is there, then an If on its variable. Inside the If, use Create Folder for an archive folder and Move File or Folder to move the file into it.

Type spreadsheet data into another program#

  1. Save the spreadsheet as CSV.
  2. Create variables for the values (for example Name as Text, Amount as Decimal) and two Integer variables, Row and Rows.
  3. Count CSV Rows into Rows, then Set Variable Row = 1.
  4. Loop Until Row > @Rows. Inside it: Read CSV Row {Row} into Name, Amount; Bring Window to Front for the other program; Type Text {Name}, Press Key Tab, Type Text {Amount}, Press Key Enter; then Change Variable Add 1 to Row. Finish with End Loop.