我有一个问题,AutoHotkey告诉我在“else”前面缺少{
,我认为我的代码很好。 (直到我将与窗口相关的if从Pidgin更改为qutIM为止,它一直有效)
^!p::
IfWinExist ahk_class QWidget, ,qutIM { ;if there is a qutIM-window other than the buddy-list...
IfWinNotActive ahk_class QWidget, , qutIM { ;ans it is not active...
WinActivate
} else { ;the closing bracket in front of the else here puts AHK off...
WinMinimize
}
} else { ;do some stuff with the buddy-list
; [...]
}
return
我担心自己忽略了一些愚蠢的事情,但似乎无法解决这个问题。
最佳答案
如果我没记错的话,那么True True Brace样式仅适用于纯If语句,不适用于IfWinExist等化合物。
From the documentation for if-expressions:
The One True Brace (OTB) style may optionally be used with if-statements that are expressions (but not traditional if-statements).
就是您必须使用WinExist()表单,而不是IfWinExist。
关于compiler-errors - 复合行if语句在同一行花括号上的AutoHotkey阻塞,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1828197/