How can I loop the program for specified period of time #40
Unanswered
iamraghav1503
asked this question in
Q&A
Replies: 2 comments
-
|
Hello @iamraghav1503 ! |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Hey! 👋 You can do this using a time-based loop in Python along with a counter for unique numbers. Here’s a simple and clean version: import pyautogui as pe
import time
start_time = time.time()
counter = 1
# Run for 2 hours (2 * 60 * 60 seconds)
while time.time() - start_time < 7200:
pe.moveTo(132, 475, 1)
pe.click(132, 475, 1)
# Add unique number after 'camera'
message = f"superb bro i want this because of camera{counter}"
pe.typewrite(message)
pe.click(917, 515, 1)
counter += 1
time.sleep(1) # small delay to avoid too fast execution
print("Finished running for 2 hours ✅")🔹 Explanation (simple)
💡 Tip If you want random unique numbers instead of sequential ones, you can use: import random
random.randint(1000, 9999)Hope this helps! Let me know if you want to modify timing or speed 🙂 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
pe.moveTo(132,475,1),pe.click(132,475,1),pe.typewrite(superb bro i want this because of camera),pe.click(917,515,1)
i want to loop this program for 2 hours and after the word 'camera' in the sentence i want to add non repeating unique numbers
Beta Was this translation helpful? Give feedback.
All reactions