New to the forum.
I'm writing a script that constantly needs to know what window is under the mouse cursor. First I wrote a sub routine. But, since I want to improve my scripting skills, I started creating an object instead of a subroutine.
This is the object:
Code: Select all
WindowUnderMouse() {
MouseGetPos , , , ID
WinGetTitle Title, ahk_id %ID%
WinGet, Process, ProcessName, ahk_id %ID%
WinGetPos, , , WX, WY, ahk_id %ID%
Return {Title:Title, Process:Process, WX:WX, WY:WY, ID:ID}
}
Code: Select all
if (WindowUnderMouse().Process = "notepad.exe")
{
MsgBox Yes
}
else
{
MsgBox No
}
But if I try to do this instead:
Code: Select all
if ("notepad.exe" in WindowUnderMouse().Process)
{
MsgBox Yes
}
else
{
MsgBox No
}
return
Someone has any workaround?