AutoHotkey:无法关闭此脚本的前一个实例。继续等待?
AutoHotkey: Could not close the previous instance of this script. Keep waiting?
我有一个 AutoHotkey 脚本,当我再次尝试 运行 时出现以下错误:
Could not close the previous instance of this script. Keep waiting?
这是一个非常简单的脚本,具有以下设置:
#NoEnv
#SingleInstance force
SendMode Input
DetectHiddenWindows, on
SetWinDelay, -1
我正在从命令行启动脚本。我试过使用 /f
/ /force
选项但没有效果。
我想要文档中描述的 #SingleInstance Force
行为,描述为:
Skips the dialog box and replaces the old instance automatically, which is similar in effect to the Reload command.
原来问题出在 SetWinDelay
指令上。
来自文档:
Although a delay of -1 (no delay at all) is allowed, it is recommended that at least 0 be used, to increase confidence that the script will run correctly even when the CPU is under load.
A delay of 0 internally executes a Sleep(0), which yields the remainder of the script's timeslice to any other process that may need it. If there is none, Sleep(0) will not sleep at all.
当我将它设置为 -1
时,脚本从来没有时间处理其他命令,包括发送给它的任何退出命令。
确保 SetWinDelay
大于或等于 0。
我有一个 AutoHotkey 脚本,当我再次尝试 运行 时出现以下错误:
Could not close the previous instance of this script. Keep waiting?
这是一个非常简单的脚本,具有以下设置:
#NoEnv
#SingleInstance force
SendMode Input
DetectHiddenWindows, on
SetWinDelay, -1
我正在从命令行启动脚本。我试过使用 /f
/ /force
选项但没有效果。
我想要文档中描述的 #SingleInstance Force
行为,描述为:
Skips the dialog box and replaces the old instance automatically, which is similar in effect to the Reload command.
原来问题出在 SetWinDelay
指令上。
来自文档:
Although a delay of -1 (no delay at all) is allowed, it is recommended that at least 0 be used, to increase confidence that the script will run correctly even when the CPU is under load.
A delay of 0 internally executes a Sleep(0), which yields the remainder of the script's timeslice to any other process that may need it. If there is none, Sleep(0) will not sleep at all.
当我将它设置为 -1
时,脚本从来没有时间处理其他命令,包括发送给它的任何退出命令。
确保 SetWinDelay
大于或等于 0。