JMacro Readme

JMacro can be used to automate many tasks. It was designed to be used in conjunction with applications which require a lot of repetitious input (mainly games).

The macro syntax is described below. The delimiter between commands is any type of whitespace (spaces, tabs, newlines). All durations are entered in milliseconds. All commands are case sensitive. The syntax supports comments in the form of //comment and /*comment*/

Settings

All settings can be overridden within the macro script as detailed in the Commands section below

Loop
    Check this option if the macro script should never stop executing
Event Delay
    The default pause, in milliseconds, between each command. Note that JMacro attempts to "catch back up" if it detects that a macro is taking longer than it should based on the event delay (example: a macro with 10 events and an event delay of 500 should take about 5 seconds to execute). For this reason, be careful when setting the event delay to 0, as this will cause a macro execution to behave unexpectedly, especially with pauses
Initial Start Delay
    The amount of time to pause between pressing the Start button and starting the macro

Commands

Input Commands

command
command ( duration )
    Hold input down for duration milliseconds
command ( duration , continue )
    Hold input down for duration milliseconds and proceed with script without waiting for this command to complete

Looping Commands

loop ( count , command(s) )
    Loop the specified command(s) count times
timedLoop ( duration , command(s) )
    Loop over the specified command(s) until duration milliseconds has passed. The last looped iteration may exceed the duration
exitLoop
    Stops the innermost loop currently executing and resumes after that loop. If current execution is not inside a loop, the macro will stop and return the beginning if the macro is set to loop

Pause Command

pause ( duration )
    Pause for duration milliseconds. A pause command will override any default pause between events

Mouse Move Command

mouse( x , y )
    Move the mouse to the specified coordinates. To measure coordinate location, the current mouse coordinates are always displayed in the lower-right corner of the JMacro window
mouse( x , y , smooth )
    Supplying the "smooth" argument to the mouse movement command will cause the event to move the mouse in a straight line between the origin point and the destination point, passing each coordinate along the way. This allows JMacro to better simulate the user manually moving a mouse from coordinate to coordinate

Color Conditional Command

ifColor( x , y , #color , command(s) )
    If the pixel at screen coordinate [x,y] is color, perform the specified command(s)
ifNotColor( x , y , #color , command(s) )
    Opposite of ifColor command. If the pixel at screen coordinate [x,y] is not color, perform the specified command(s)

Stop Command

stop
    Stops the macro as if the user pressed the "Stop" button

Setting Overrides

//override_loop (true|false)
//override_event_delay milliseconds
//override_initial_delay milliseconds

Examples

Press the left mouse button, then press W for ten seconds

mouseLeft
W(10000)

While holding down shift and the W key, click the left mouse button repeatedly for twenty seconds

shift(20000, continue)
W(20000, continue)
timedLoop(20000, mouseLeft)

If the pixel color at the specified location is red, click the left mouse button

ifColor( 525, 600, #FF0000,
    mouseLeft
)