代码量也不大,能实现基本的点点点和esc按键中止功能就行。
关于x和y坐标的选取,用微信截图就行了,会显示POS坐标,拿过来用。
image.png (52.1 KB, 下载次数: 0)
下载附件
2023-6-2 16:39 上传
感觉之后还是得用autojs来做比较好,想做一个比较全面完善的脚本。
image.png (29.8 KB, 下载次数: 0)
下载附件
2023-6-2 16:39 上传
需要用到的库:
[Python] 纯文本查看 复制代码pip install pynput pyautoit
给个Python代码:
[Python] 纯文本查看 复制代码import tkinter as tk
from tkinter import ttk
import time
import autoit
import threading
from tkinter import messagebox
from pynput import keyboard
import sys
# 增大迭代限制
sys.setrecursionlimit(1000000000)
class App:
def __init__(self, master):
self.master = master
master.title("简易连点器-小锋学长生活大爆炸(ESC键停止)")
# 设置连点的时间间隔,单位为毫秒
self.interval = 0.5
# 连点计数器
self.click_count = 0
self.click_total = 10
# 创建输入框
self.x_label = tk.Label(master, text="X坐标:", width=15)
self.x_label.grid(row=0, column=0, padx=5, pady=10)
self.x_entry = tk.Entry(master, width=10)
self.x_entry.insert(tk.END, "100")
self.x_entry.grid(row=0, column=1, padx=5, pady=10)
self.y_label = tk.Label(master, text="Y坐标:", width=15)
self.y_label.grid(row=1, column=0, padx=5, pady=10)
self.y_entry = tk.Entry(master, width=10)
self.y_entry.insert(tk.END, "100")
self.y_entry.grid(row=1, column=1, padx=5, pady=10)
# 增加self.click_total的输入框
self.total_label = tk.Label(master, text="点击总数(0为无限):", width=15)
self.total_label.grid(row=2, column=0, padx=5, pady=10)
self.total_entry = tk.Entry(master, width=10)
self.total_entry.insert(tk.END, "10")
self.total_entry.grid(row=2, column=1, padx=5, pady=10)
# 增加self.interval的输入框
self.interval_label = tk.Label(master, text="点击间隔(ms):", width=15)
self.interval_label.grid(row=3, column=0, padx=5, pady=10)
self.interval_entry = tk.Entry(master, width=10)
self.interval_entry.insert(tk.END, "500")
self.interval_entry.grid(row=3, column=1, padx=5, pady=10)
# 创建进度条和标签
self.progress_bar = ttk.Progressbar(master, orient="horizontal", mode="determinate")
self.progress_bar.grid(row=4, column=0, padx=5, pady=10)
self.progress_label = tk.Label(master, text="0 / {}".format(self.click_total), width=5)
self.progress_label.grid(row=4, column=1, padx=5, pady=10)
# 创建启动和停止按钮
self.start_button = tk.Button(master, text="启动", command=self.start_click, width=5)
self.start_button.grid(row=5, column=0, padx=5, pady=10)
self.stop_button = tk.Button(master, text="停止", command=self.stop_click, width=5)
self.stop_button.grid(row=5, column=1, padx=5, pady=10)
# 创建一个标志,表示是否按下了ESC键
self.esc_pressed = False
def start_click(self):
# 启动连点器
self.x = int(self.x_entry.get())
self.y = int(self.y_entry.get())
self.click_count = 0
self.running = True
self.click_total = int(self.total_entry.get()) or 1e9
self.interval = int(self.interval_entry.get()) / 1000
self.progress_bar["maximum"] = self.click_total
self.progress_bar["value"] = 0
# 创建一个子线程,用于监听键盘是否按下ESC键
self.listener_thread = threading.Thread(target=self.listener_start)
self.listener_thread.start()
while self.running and self.click_count