帮你问了一下AI,给出如下的python脚本,我没运行测试,你自己看看吧。

通义千问给的脚本也差不多。
import pyautogui
import time
import os
def click_and_capture(x, y, px, py, width, height, spath, n):
    for i in range(n):
        # 模拟鼠标点击
        pyautogui.click(x, y)
        
        # 等待3秒
        time.sleep(3)
        
        # 屏幕截图并保存
        screenshot = pyautogui.screenshot(region=(px, py, width, height))
        filename = f'screenshot_{i+1}.png'
        filepath = os.path.join(spath, filename)
        screenshot.save(filepath)
        
        print(f"Screenshot {i+1} saved.")
# 设置参数
x, y = 500, 300  # 鼠标点击的位置
px, py = 200, 150  # 截图区域的左上角坐标
width, height = 600, 400  # 截图区域的宽度和高度
spath = 'screenshots'  # 保存截图的目录
n = 5  # 重复次数
# 确保保存路径存在
if not os.path.exists(spath):
    os.makedirs(spath)
# 执行操作
click_and_capture(x, y, px, py, width, height, spath, n)※ 修改:·poocp 于 May 26 19:39:23 2024 修改本文·[FROM: 171.221.52.*]
※ 来源:·水木社区 
http://www.mysmth.net·[FROM: 171.221.52.*]
修改:poocp FROM 171.221.52.*
FROM 171.221.52.*