多种办法
办法1:(推荐)JavaScript方案:需要安装Tampermonkey浏览器扩展
[JavaScript] 纯文本查看 复制代码 // 使用Tampermonkey或Violentmonkey等用户脚本管理器安装此脚本
// ==UserScript==
// [url=home.php?mod=space&uid=170990]@name[/url] 自动点击继续学习
// [url=home.php?mod=space&uid=467642]@namespace[/url] [url]http://tampermonkey.net/[/url]
// [url=home.php?mod=space&uid=1248337]@version[/url] 0.1
// @description 自动点击防挂机验证的"继续学习"按钮
// [url=home.php?mod=space&uid=686208]@AuThor[/url] YourName
// [url=home.php?mod=space&uid=195849]@match[/url] *://*/*
// [url=home.php?mod=space&uid=609072]@grant[/url] none
// ==/UserScript==
(function() {
'use strict';
function clickContinueButton() {
const buttons = document.querySelectorAll('button, input[type="button"], a');
buttons.forEach(button => {
if (button.textContent.includes('继续学习')) {
button.click();
console.log('已自动点击继续学习按钮');
}
});
}
// 每5秒检查一次
setInterval(clickContinueButton, 5000);
})();
方法2:AutoHotkey脚本
[AAuto] 纯文本查看 复制代码 #Persistent
SetTitleMatchMode, 2
Loop {
; 检查"提示"窗口是否存在
IfWinExist, 提示
{
WinActivate
ControlGetPos, X, Y, Width, Height, Button1, 提示
if (X != "") {
; 计算按钮中心位置并点击
CenterX := X + Width // 2
CenterY := Y + Height // 2
Click, %CenterX%, %CenterY%
ToolTip, 已自动点击继续学习按钮, 0, 0
Sleep, 10000 ; 点击后等待10秒
} else {
; 如果没有找到按钮控件,尝试点击窗口中心偏下位置
WinGetPos, winX, winY, winWidth, winHeight, 提示
Click, % (winX + winWidth // 2), % (winY + winHeight - 50)
ToolTip, 已尝试点击继续学习按钮, 0, 0
Sleep, 10000
}
} else {
ToolTip, 未检测到验证窗口, 0, 0
}
Sleep, 5000 ; 每5秒检查一次
}
方法3:用python编写小工具
[Python] 纯文本查看 复制代码 import pyautogui
import time
import pygetwindow as gw
def find_and_click_continue():
try:
# 查找包含"提示"的窗口
windows = gw.getWindowsWithTitle("提示")
if windows:
window = windows[0]
window.activate()
# 获取窗口位置
x, y, width, height = window.left, window.top, window.width, window.height
# 计算按钮大致位置(通常在窗口中间偏下)
button_x = x + width // 2
button_y = y + height - 50
# 移动鼠标并点击
pyautogui.moveTo(button_x, button_y, duration=0.5)
pyautogui.click()
print("已自动点击继续学习按钮")
return True
except Exception as e:
print(f"发生错误: {e}")
return False
def main():
print("防挂机验证自动点击工具运行中...")
while True:
if find_and_click_continue():
time.sleep(10) # 点击成功后等待10秒再检查
else:
time.sleep(5) # 未找到窗口,5秒后重试
if __name__ == "__main__":
main() |