GUI automation

This project includes a set of scripts for automating GUI interactions and logging keystrokes. The main components are:

  • automate_gui.ipynb: A Jupyter notebook that uses OpenAI to generate keystrokes which can be replayed into an application to accomplish a task. It also includes functionality for encoding images to base64 format.
  • keylogger.py: A Python script that logs keyboard and mouse events. It uses the pynput library to capture these events and writes them to a file.
  • measure.html: An HTML file that provides a GUI for measuring distances and areas in an image. It uses JavaScript and HTML5 Canvas for the GUI and calculations.

Installation

  1. Clone the repository to your local machine.
  2. Install the required Python packages using pip:
pip install -r requirements.txt

Usage

automate_gui.ipynb

  1. Open the notebook in Jupyter.
  2. Run the cells in order. The final cell will output the generated keystrokes.

keylogger.py

  1. Run the script in a Python environment.
  2. Perform keyboard and mouse actions that you want to log.
  3. Press the 'Esc' key to stop logging.
  4. The logged events will be written to a file named 'events-.txt'.
  5. Replay from the file with python keylogger.py --replay [file name]

Note that replaying arbitrary events generated by AI on the internet on your real computer is low-to-moderately risk, depending on what task you're automating. You assume all responsibility for this software's usage — in particular I could imagine it accidentally clicking delete on a file or closing a window and you losing unsaved work, or worse. Use at your own risk!

measure.html

  1. Open the HTML file in a web browser.
  2. Use the 'Choose File' button to load an image.
  3. Enter a real-world distance for scale, then click 'Start Scale' and mark two points on the image.
  4. Click 'Set Scale', then use 'Calculate Distances' or 'Calculate Area' as needed.
  5. Intended for measuring roofing, it includes a 'predominant pitch' field.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

This project is licensed under the terms of the MIT license.