Untitled
unknown
plain_text
5 months ago
2.0 kB
2
Indexable
import ctypes import time import random from datetime import datetime, timedelta MOUSEEVENTF_MOVE = 0x0001 class MOUSEINPUT(ctypes.Structure): _fields_ = (("dx", ctypes.c_long), ("dy", ctypes.c_long), ("mouseData", ctypes.c_ulong), ("dwFlags", ctypes.c_ulong), ("time", ctypes.c_ulong), ("dwExtraInfo", ctypes.POINTER(ctypes.c_ulong))) class INPUT(ctypes.Structure): _fields_ = (("type", ctypes.c_ulong), ("mi", MOUSEINPUT)) def m_mv(x, y): mi = MOUSEINPUT(x, y, 0, MOUSEEVENTF_MOVE, 0, None) input_event = INPUT(ctypes.c_ulong(0), mi) ctypes.windll.user32.SendInput(1, ctypes.pointer(input_event), ctypes.sizeof(input_event)) def mv_m_r(duration, distance): on = False switch = False current_h = 0 b_interval = timedelta(hours=2) next_b_t = datetime.now() + b_interval while True: current_t = datetime.now() if False: random_b_d = random.randint(6, 14) * 60 print("b on") time.sleep(random_b_d) print("b off") next_b_t = current_t + b_interval if (datetime.now().hour > current_h): print(datetime.now().hour) current_h = datetime.now().hour if (start_h > current_h): if (on == True): on = False print("off") time.sleep(300) continue if (end_h < current_h): if (on == True): on = False print("off") time.sleep(300) continue if (on == False): on = True print("on") if (switch): m_mv(distance, 0) switch = False else: m_mv(distance*-1, 0) switch = True time.sleep(duration) if __name__ == "__main__": duration = 3 distance = 3 start_h = 8 end_h = 18 mv_m_r(duration, distance)
Editor is loading...
Leave a Comment