【发布时间】:2019-07-19 09:09:55
【问题描述】:
在此问题中调用 setXTowerLocation(),退出消息框后会出现一个消息框,调用函数 getXCords() 在其中它不断扫描检查 Lbutton 的 keyState,一旦它检测到它被按下 getxCords()函数返回鼠标绳索的 x 值,该值又在 setXTowerLocation() 函数中设置为全局变量,然后返回并在消息框中显示 x 绳索。每次我运行它时,消息框都会出现空白,我已经测试了代码的各个方面,它们似乎都可以单独工作,所以我认为这一定是语法错误?
结束消息框仅用于测试目的。在此先感谢:)
SendMode Input
Global xTowerLocation =
setXTowerLocation()
MsgBox, 0, MessageBox, %xTowerLocation%
getxCords()
{
xCord =
Loop,
{
GetKeyState, state, Lbutton
if(state = "D")
{
MouseGetPos, xx, yy
xCord := %xx%
return
}
}
return xCord
}
setXTowerLocation() {
MsgBox, 0, MessageBox, Begin?
IfMsgBox OK
xTowerLocation := getxCords()
return
}
【问题讨论】:
标签: autohotkey