|
|
|
|
@ -1,4 +1,4 @@
@@ -1,4 +1,4 @@
|
|
|
|
|
import win32gui, win32con, time, os, sys |
|
|
|
|
import win32gui, win32con, time, os, sys,redis |
|
|
|
|
import pyautogui as ag |
|
|
|
|
import platform |
|
|
|
|
if platform.system() == 'Windows': |
|
|
|
|
@ -103,6 +103,7 @@ def get_defineDistances(pid, left, top, right, bottom):
@@ -103,6 +103,7 @@ def get_defineDistances(pid, left, top, right, bottom):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def repeat_backspace(times): |
|
|
|
|
for i in range(times): |
|
|
|
|
ag.press('backspace') |
|
|
|
|
@ -122,9 +123,16 @@ def defind_distance(pid, left, top, right, bottom):
@@ -122,9 +123,16 @@ def defind_distance(pid, left, top, right, bottom):
|
|
|
|
|
ag.hotkey('ctrl', 's') # save project |
|
|
|
|
ag.hotkey('alt', 'f4') # close project |
|
|
|
|
print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} {pid} 定义定位点距离完成') |
|
|
|
|
time.sleep(3) |
|
|
|
|
|
|
|
|
|
#更新 r.lpush('model:auto_distance', pid+"_0") |
|
|
|
|
|
|
|
|
|
#加入pid+"_1"的队列 |
|
|
|
|
redisLocal.lpush('model:auto_distance', pid+"_1") |
|
|
|
|
#去掉pid+"_0"的队列 |
|
|
|
|
redisLocal.lrem('model:auto_distance', 0, pid+"_0") |
|
|
|
|
|
|
|
|
|
def main(): |
|
|
|
|
redisLocal = config.redis_local |
|
|
|
|
while True: |
|
|
|
|
time.sleep(1) |
|
|
|
|
title = "wait" |
|
|
|
|
@ -132,6 +140,13 @@ def main():
@@ -132,6 +140,13 @@ def main():
|
|
|
|
|
if pid == '0': |
|
|
|
|
pass |
|
|
|
|
else: |
|
|
|
|
|
|
|
|
|
#判断是否已经存在了,已经存在就不在处理了 |
|
|
|
|
if redisLocal.sismember('model:auto_distance', pid+"_0") or redisLocal.sismember('model:auto_distance', pid+"_1"): |
|
|
|
|
continue |
|
|
|
|
|
|
|
|
|
redisLocal.lpush('model:auto_distance', pid+"_0") |
|
|
|
|
|
|
|
|
|
print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} 找到{pid}的定位点距离定义窗口,开始定位点距离定义...') |
|
|
|
|
start_time = time.time() |
|
|
|
|
defind_distance(pid, left, top, right, bottom) |
|
|
|
|
|