2024-06-13 09:15:00 +02:00
|
|
|
from pyautogui import press, position
|
2024-06-12 15:59:21 +02:00
|
|
|
from time import sleep
|
2024-06-13 09:15:00 +02:00
|
|
|
from threading import Thread
|
|
|
|
|
2024-06-12 15:59:21 +02:00
|
|
|
|
|
|
|
def action():
|
|
|
|
while True:
|
2024-06-13 09:15:00 +02:00
|
|
|
press("win")
|
|
|
|
sleep(0.5)
|
2024-06-12 15:59:21 +02:00
|
|
|
press("win")
|
|
|
|
sleep(20)
|
|
|
|
|
2024-06-13 09:15:00 +02:00
|
|
|
|
|
|
|
def wait_mouse():
|
|
|
|
previous_x, previous_y = position()
|
|
|
|
threshold = 50
|
|
|
|
|
|
|
|
while True:
|
|
|
|
position_x, position_y = position()
|
|
|
|
if (abs(position_x - previous_x) > threshold or abs(position_y - previous_y) > threshold):
|
|
|
|
return
|
|
|
|
|
|
|
|
previous_x, previous_y = position_x, position_y
|
|
|
|
sleep(0.1)
|
|
|
|
|
|
|
|
|
2024-06-12 15:59:21 +02:00
|
|
|
if __name__ == "__main__":
|
2024-06-13 09:15:00 +02:00
|
|
|
t = Thread(target=action)
|
|
|
|
t.daemon = True
|
|
|
|
t.start()
|
|
|
|
|
|
|
|
wait_mouse()
|