如何暂时禁用 AutoHotkey 中的鼠标左键激活代码?

How can one temporarily disable Left-mouse-button activated code in AutoHotkey?

我希望代码由鼠标左键触发 仅当变量 toggle 等于 1 时 ,否则我希望鼠标左键-按钮正常工作。

我尝试了以下方法:

LButton::
if (toggle=1) {
  ;do code
}

上面代码的问题在于,如果变量 toggle 等于 0,则鼠标左键将根本不起作用。

即使我把代码改成

LButton::
if (toggle=1) {
  ;do code
}
else {
Click
}

然后鼠标按钮会点击(虽然是模拟的)但是拖动等功能将不起作用。

你检查过#If了吗?你这个:

#If ( toggle = 1 )
LButton::
   ;do code
Return
#If