But info in test code below is not working as I expected
Where did I made mistake? Is info := "" mandatory for object (I think)?
Test code:
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
; Press num*
NumpadMult::
{
MouseGetPos mX, mY
; info := "" ; if omitted, info won't be released in last run
if(mX > 500){
info := GetInfo({"x":mX, "y":mY})
}
dataStr := ""
for i,v in info.data {
dataStr .= i . ": " . v . "`n"
}
result := "pos: " . mX . ", " . mY . "`ndatastr: `n" . dataStr
ToolTip % result
return
}
GetInfo(data){
info := {Count: 0 ,data: {}}
for name, value in data {
info.Count++
info.data[name] := value
}
return info
}