-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
45 lines (34 loc) · 1.36 KB
/
Copy pathmain.py
File metadata and controls
45 lines (34 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import time
from PIL import ImageGrab
import pyautogui
import keyboard
import os
# Function to capture the specific pixel color
def get_pixel_color(x, y):
screenshot = ImageGrab.grab(bbox=(x, y, x+1, y+1))
return screenshot.getpixel((0, 0))
# Main loop
target_color = (255, 85, 85) # RGB value for #FF5555
x, y = 1601, 919
while True:
if keyboard.is_pressed('F7'): # Check if F7 is pressed to stop the script
print("F7 pressed. Exiting script.")
os._exit(1) # Exit the script
# Get the color of the specific pixel
pixel_color = get_pixel_color(x, y)
if pixel_color == target_color:
print("Target color detected at (1601, 919). Waiting 75 milliseconds before the first right-click...")
# Wait 75 milliseconds
time.sleep(0.075)
# First right-click
pyautogui.click(button='right')
print("First right-click performed, waiting 5 milliseconds before the next click...")
# Wait 5 milliseconds
time.sleep(0.005)
# Second right-click
pyautogui.click(button='right')
print("Second right-click performed, waiting 500 milliseconds before resuming detection...")
# Wait 500 milliseconds after the second right-click
time.sleep(0.5)
# Check the pixel color every 5 milliseconds
time.sleep(0.005)