TGViewer
DBin_K 🤯 Tingle 灵光一闪 💡 DBin_K 🤯 Tingle 灵光一闪 💡 @dbinkbb · 2.26K subscribers
Post #2581 609
import ctypes
import dxcam_cpp as dxcam

SendInput = ctypes.windll.user32.SendInput

INPUT_MOUSE = 0
MOUSEEVENTF_LEFTDOWN = 0x0002
MOUSEEVENTF_LEFTUP = 0x0004

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 send_click():
inp = INPUT(INPUT_MOUSE, MOUSEINPUT(0, 0, 0, MOUSEEVENTF_LEFTDOWN, 0, None))
SendInput(1, ctypes.byref(inp), ctypes.sizeof(inp))
inp = INPUT(INPUT_MOUSE, MOUSEINPUT(0, 0, 0, MOUSEEVENTF_LEFTUP, 0, None))
SendInput(1, ctypes.byref(inp), ctypes.sizeof(inp))

WIDTH, HEIGHT = 3840, 2160
mx, my = WIDTH // 2, HEIGHT // 2

TARGET_B, TARGET_G, TARGET_R = 230, 55, 55

camera = dxcam.create(
device_idx=0,
region=(mx, my, mx + 1, my + 1)
)

last_is_red = False

while True:
frame = camera.grab()
if frame is None:
continue

b, g, r = frame[0, 0]

cur_is_red = (b == TARGET_B and g == TARGET_G and r == TARGET_R)

if last_is_red and not cur_is_red:
send_click()
print("点击触发")

last_is_red = cur_is_red
More from @dbinkbb
  1. Sep 25, 2026https://keepandroidopen.org/zh-CN/
  2. Sep 20, 2026https://x.com/nini_incrypto_/status/2101569201668505658
  3. Sep 17, 2026这个有点意思 ,想起来之前那个 Bionic Reading,是通过把单词前几个字母加粗来缓解注意力疲劳,这个直接用上 LLM 技术来高亮了,让中文也能享受到这样的观感 😋 ht…
  4. Sep 17, 2026分享一个写的非常好的 AGENTS.md https://github.com/Da1sypetals/AGENTS.md #Agent #LLM #Prompt
  5. Sep 13, 2026#PyCon2026 #深圳
  6. Sep 8, 2026Agent 时代,上班写代码变成了给 Agent 写提示词,Review 别人的代码变成了给别人的 Agent 写提示词 #编程 #Agent #胡言乱语
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →