This Python script automates keyboard right arrow key and pressing right arrow key to move through a document or file using the pyautogui library. It provides functionality to pause and resume moving based on user input, specifically using the Esc key.
- Movement Automation: Moves the cursor to the start of the file and move to the end by simulating right arrow key presses.
- Pause Functionality:
- Press
Esconce to pause the script for 10 seconds. - Press
Escand hold it for more than 0.5 seconds, then pressEsctwice to pause the script. - Press
Esctwice to resume scrolling when the script is paused.
- Press
- Python: Ensure Python 3.x is installed on your system.
- Required Libraries: Install the required Python libraries using
pip.
-
Clone the Repository (if applicable):
git clone https://github.com/imparth7/keyboard-automation.git cd keyboard-automation -
Install Required Libraries:
pip install -r requirements.txt
-
Prepare Your Document:
- Make sure the document or file you want to move through is in focus.
-
Run the Script:
python main.py
-
Controlling the Script:
- Press
Esconce: Pauses the script for 10 seconds. - Hold
Escfor more than 0.5 seconds: Switches to waiting for a doubleEscpress. - Press
Esctwice: Toggles the pause state. The script will resume if it was paused.
- Press
- Ensure that the document or window you want to move through is active and focused when running the script.
- Adjust the sleep durations in the script if necessary to match your system’s performance and responsiveness.
- Script Not Scrolling: Verify that the document is focused and the right arrow key moves the cursor as expected. Adjust the sleep times if needed.
- Key Presses Not Detected: Ensure the
keyboardlibrary has the necessary permissions and that no other program is intercepting key presses.
This project is licensed under the MIT License.
For any questions or issues, please contact me imparth or open an issue on the GitHub repository.