May-20-2021, 02:52 PM
(This post was last modified: May-20-2021, 04:25 PM by Yoriz.
Edit Reason: Added code tags
)
Hello , i'm trying to create a loop with 3 text messages . All of them run in the same time using just a time.sleep to create a pause but i don't know how to make them stop in a given order smth like text1 stop after 10 seconds text 2 stop at 15 and text 3 after 5 , i managed to get this right just for 1 text but don't know how to do it to a number of different texts
import time
import pyautogui,datetime
start = time.time()
PERIOD_OF_TIME = 10 # 10secs
while True :
print(datetime.datetime.now())
pyautogui.typewrite("Text 1")
pyautogui.press("enter")
time.sleep(5)
if time.time() > start + PERIOD_OF_TIME : break
