This commit is contained in:
HuangHai
2026-01-25 10:28:31 +08:00
parent 291497d371
commit 4551b43781
52 changed files with 194 additions and 7 deletions

View File

@@ -20,6 +20,23 @@ from Util.EasyOcrKit import get_easyocr_reader
# 调用者应自行配置日志(包括 FileHandler 等)
logger = logging.getLogger("WxUtil")
def clean_screenshots_dir():
"""
清除 d:\\dsWork\\aiData\\WeiXin\\Screenshots 目录下的所有文件
"""
screenshot_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "Screenshots")
if os.path.exists(screenshot_dir):
logger.info(f"正在清除截图目录: {screenshot_dir}")
for file in os.listdir(screenshot_dir):
file_path = os.path.join(screenshot_dir, file)
try:
if os.path.isfile(file_path):
os.remove(file_path)
except Exception as e:
logger.error(f"无法删除文件 {file_path}: {e}")
else:
logger.info(f"截图目录不存在,无需清除: {screenshot_dir}")
def find_input_box_center(image_path):
"""
识别底部输入框的中心坐标,返回 (center_x, center_y, rect_box)