From 9f584e1f5de148e28791d30668262c372aff4fe2 Mon Sep 17 00:00:00 2001 From: Chiranjeev Vyas <75154547+thechiranjeevvyas@users.noreply.github.com> Date: Mon, 14 Oct 2024 23:44:41 +0530 Subject: [PATCH 1/2] main files added --- Autotyper/README.md | 22 ++++++++++++++++++++++ Autotyper/autotyper.py | 6 ++++++ Autotyper/text.txt | 6 ++++++ 3 files changed, 34 insertions(+) create mode 100644 Autotyper/README.md create mode 100644 Autotyper/autotyper.py create mode 100644 Autotyper/text.txt diff --git a/Autotyper/README.md b/Autotyper/README.md new file mode 100644 index 000000000..59e54fff8 --- /dev/null +++ b/Autotyper/README.md @@ -0,0 +1,22 @@ +# Autotyper Script + +## Short description + +This Python script reads lines from a text file and types them automatically, simulating human-like typing behavior using the `pyautogui` and `time` libraries. + +## Short description of script + +The script achieves automated typing of text from a file to any active window. It waits for a few seconds to allow the user to focus the cursor on the desired input area before typing begins. + +## Setup instructions + +1. Install required libraries: + ```pip install pyautogui + + ``` +2. Place your text file (e.g., text.txt) in the same directory as the script or provide an absolute path in the code. +3. Run the script: + ```python autotyper.py + + ``` +4. Switch to the window where you want the text to be typed. The script will begin typing after a 5-second delay. diff --git a/Autotyper/autotyper.py b/Autotyper/autotyper.py new file mode 100644 index 000000000..5e8405587 --- /dev/null +++ b/Autotyper/autotyper.py @@ -0,0 +1,6 @@ +import pyautogui +import time +time.sleep(5) +#paste code in the text file-CV +for line in open("text.txt", "r",encoding="utf-8"): + pyautogui.typewrite(line) \ No newline at end of file diff --git a/Autotyper/text.txt b/Autotyper/text.txt new file mode 100644 index 000000000..fc5950e38 --- /dev/null +++ b/Autotyper/text.txt @@ -0,0 +1,6 @@ +This is demo text you can remove this and can place your own text + +#include +#include +using namespace std; + From dc98092b07ec0bf474cfab07fe59fd601ceb9306 Mon Sep 17 00:00:00 2001 From: Chiranjeev Vyas <75154547+thechiranjeevvyas@users.noreply.github.com> Date: Tue, 15 Oct 2024 00:02:31 +0530 Subject: [PATCH 2/2] made changes according to flake8 --- Autotyper/autotyper.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Autotyper/autotyper.py b/Autotyper/autotyper.py index 5e8405587..3a088902e 100644 --- a/Autotyper/autotyper.py +++ b/Autotyper/autotyper.py @@ -1,6 +1,10 @@ import pyautogui import time + +# Wait for 5 seconds before starting time.sleep(5) -#paste code in the text file-CV -for line in open("text.txt", "r",encoding="utf-8"): - pyautogui.typewrite(line) \ No newline at end of file + +# Paste code from the text file - CV +with open("text.txt", "r", encoding="utf-8") as file: + for line in file: + pyautogui.typewrite(line)