KeymouseGo icon indicating copy to clipboard operation
KeymouseGo copied to clipboard

强烈要求增加间隔时间

Open mimishy2000 opened this issue 1 year ago • 1 comments

没间隔时间不够方便,希望增加下一次执行操作的等待时间,这样可以周期性执行同样的操作。

mimishy2000 avatar Jan 15 '25 13:01 mimishy2000

可以写插件来实现 下面是一个例子,将会在除第一次外的每次操作后等待3秒

# LoopInterval.py
from UIFunc import ScriptEvent
import time

class LoopInterval:
    def __init__(self, runtimes, speed, thd=None, swap=None):
        self.runtimes = runtimes
        self.speed = speed
        self.thd = thd
        self.swap = swap

    # 脚本执行前需要做的事
    def onbeginp(self):
        pass

    # 每次录制事件后需要做的事,返回True保存事件
    def onrecord(self, event, currentindex):
        return True

    # 每次脚本执行前需要做的事,返回True执行本行脚本
    def onbeforeeachloop(self, currentloop):
        if currentloop != 0:
            time.sleep(3)
        return True

    # 每行脚本执行前需要做的事,返回True执行本行脚本
    def onrunbefore(self, event, currentindex):
        return True

    # 每行脚本执行后需要做的事
    def onrunafter(self, event, currentindex):
        pass

    # 每次脚本全部执行完后需要做的事
    def onaftereachloop(self, currentloop):
        pass

    # 全部循环全部执行完后需要做的事
    def onendp(self):
        pass

注意代码中类的名字要与文件名一致 将这个py文件放到plugins文件夹中,之后启动程序,扩展插件选择LoopInterval即可

aoxiangtianyu-go avatar Feb 08 '25 06:02 aoxiangtianyu-go