Benjamin Billet

◈ Ingénieur de recherche et développement, docteur en informatique

Click n' Replay

Dernière màj: 03/03/2014

Click n' Replay is a tool that enables developers to simulate mouse and keyboard events. For Windows only, requires the .NET 4 redistributable package.

Overview of the features:

  • Write scripts using a very simple human-readable language and replay them.
  • Play/pause a script, or loop.
  • Record events and generate a script automatically.
  • Supports various events (key up/down, text typing, mouse move, mouse button up/down events) and useful additional instructions (bring a process to foreground).

The source code and the binaries are available on BitBucket under the licence Creative Commons Attribution 4.0 International (CC BY 4.0) : https://bitbucket.org/bbillet/clicknreplay

The code uses a modified version of the UserActivityHook, which is distributed under the Code Project Open License (CPOL) 1.02.

Screenshots

Shortcut key

Note: Shortcut keys can be used anywhere at any time.

  • Alt+S stop the running script.
  • Alt+P pause the running script.
  • Alt+R resume the paused script.

Language instructions

CLICKDOWN x y <left|middle|right>
Simulate a "Mouse button pressed" event. Default: left button.

CLICKUP x y <left|middle|right>
Simulate a "Mouse button released" event. Default: left button.

CLICK x y <left|middle|right>
Simulate a "Click" event (mouse button pressed and then relased). Default: left button.

MOUSEMOVE x y <absolute|relative>
Simulate a mouse move. If "absolute", the cursor is moved to the point x,y. If "relative", the cursor is moved of x and y pixels from its original position. Default: absolute.

PAUSE milliseconds
Make a pause.

TYPE text
Simulate text typing (equivalent to a sequence of KEY commands). In loop mode, the sequence [LOOP_COUNTER] is automatically replaced by the current number of loop.

KEYDOWN keyCode
Simulate a "Key pressed" event. The keyCode can be either decimal or hexadecimal (begin with 0x). See the Virtual-Key Code Table.

KEYUP keyCode
Simulate a "Key released" event. The keyCode can be either decimal or hexadecimal (begin with 0x). See the Virtual-Key Code Table.

KEY keyCode
Simulate a "Keystroke" event (key pressed and then released). The keyCode can be either decimal or hexadecimal (begin with 0x). See the Virtual-Key Code Table.

FOREGROUND processName
Find a process by its name and bring it to foreground.

Remarks

The recording tool has some limitations and can only record typing events and clicks. Other instructions must be written manually into the script.
I plan to improve this part in the future.

Event simulation does not work well inside desktop virtual machine with mouse sharing enabled (tested with VirtualBox).