Record and Play with Python!

This allows you to record keyboard and mouse input, and play it back (with looping) using pynput. It allows for automation of any repetitive computer tasks.

Installation

  • Clone or download this repository
  • Navigate to the repository in cmd or terminal
  • Run pip install -r requirements.txt

Usage

  • Simply run the ‘record.py’ file with Python3 using one input argument -> “name_of_recording”. Whatever you do thereafter will be recorded.
  • To end the recording click the escape key (to end the Keyboard thread), and hold down the right click on the mouse for more than 2 seconds – then release (to end the Mouse thread).
  • To play back the recording, run the ‘play.py’ file with Python3 using two input arguments -> “name_of_recording” ‘number_of_repeats’.

If you want to kill the play-back early, you can trigger a KeyboardInterrupt by clicking into the terminal window and pressing ‘ctrl c’ – although you’ll have to do this while the automation is running.

Notes

  • The data file takes in mouse movements every 50th of a second when holding down the left click on the mouse (dragging). If you aren’t dragging a lot then you can run a relatively lengthy automation without creating a huge data file, however, if you’re dragging a lot, keep the recording relatively short, as the data file will quickly fill up with mouse-movement JSON data.

Scrolling functionality is suppported, however it is not completely precise, due to the carry through nature of scrolling on many applications. So it is recommended to drag scrollbars when available.

Compatablitity

This is Mac compatiable – as I haven’t been able to find others out there that are.

Authors

George Jensen

Support!

If you found this tool useful please give this repo a star!

GitHub

GitHub - george-jensen/record-and-play-pynput: This allows you to record keyboard and mouse input, and play it back using pynput.
This allows you to record keyboard and mouse input, and play it back using pynput. - GitHub - george-jensen/record-and-play-pynput: This allows you to record keyboard and mouse input, and play it b...