0
我不是一个AutoHotkey的大师,而我在与递减可变麻烦,如果是大于0每秒一次:的AutoHotkey - 递减变量每秒一次
Loop
{
If spaceFreq > 0
spaceFreq--
If returnFreq > 0
returnFreq--
Sleep, 1000
}
这有什么问题脚本?变量没有被减少。
我不是一个AutoHotkey的大师,而我在与递减可变麻烦,如果是大于0每秒一次:的AutoHotkey - 递减变量每秒一次
Loop
{
If spaceFreq > 0
spaceFreq--
If returnFreq > 0
returnFreq--
Sleep, 1000
}
这有什么问题脚本?变量没有被减少。
to decrement a value and store the result back in the same variable directly,
you must do
ex: Var := --x instead of Var := x--
because --x decrements X immediately and then assigns its value to Var
x-- increments X only after assigning the current value of X to Var consequently,
not modifying the original variable, if no variable is specified.
了解更多关于here ...递减我 建议使用SetTimer,而不是循环和睡眠..
例如:
#Persistent
SetTimer, decrementlabel, 1000 ;1000 ms = 1 second
return
decrementlabel:
If spaceFreq > 0
--spaceFreq
If returnFreq > 0
--returnFreq
return