Tool-Assisted Speedrun (TAS) Program Supporting Recording, Playing Back, Editing & Saving Keyboard & Mouse Inputs with a Text Editor to Modify, Save & Load with a GUI
- Record: Captures keyboard and mouse actions with precise timings.
- Playback: Executes a recorded or edited script.
- Edit: A simple text editor allows you to manually modify the script.
- Save/Load: Scripts can be saved to and loaded from files in JSON format.
- Python 3.x
pynputlibrary
- Make sure you have Python 3 installed.
- Install the required library using pip:
pip install pynput
- Save the code as a Python file (e.g.,
tas.py). - Run the script from your terminal:
python tas.py
- The GUI application will open.
- Click the Record button. The status will change to "Recording...".
- You have a 1-second delay to switch focus to your target application (e.g., an emulator window).
- Perform the actions (key presses, mouse clicks, etc.) you want to record.
- Click the Stop button in the TAS tool to finish recording.
- The captured actions will appear as a JSON script in the text editor.
- You must have a script loaded in the editor, either by recording or loading a file.
- Click the Play button.
- Quickly switch focus to your target application. The script will begin playing.
- You can interrupt playback at any time by clicking the Stop button.
- The script is in a human-readable JSON format. You can directly edit the values in the text box.
- Each action has a
time(in seconds since recording started), atype, and other relevant parameters (key,x,y, etc.). - You can manually adjust timings, change keys, or remove unwanted actions. Be careful to maintain the valid JSON structure.
- Save Script: After recording or editing, click Save Script to save the contents of the editor to a
.jsonfile. - Load Script: Click Load Script to open a
.jsonfile and load its contents into the editor for playback or further editing.
The script is a JSON array of event objects. Each object represents a single action.
Example event:
{
"time": 2.153,
"type": "key_press",
"key": "a"
}time: The timestamp in seconds from the start of the recording.type: The type of event (key_press,key_release,mouse_move,mouse_click,mouse_scroll)....args: Other parameters depend on the event type. For example, amouse_clickincludesbutton,action,x, andy.