My if statement on line 8 isn't working. Even though the Msgbox of %Width% shows 3200 I always get the "width is not 3200" message box. Changing the if to == and putting checking for "3200" rather than 3200 has no effect.
I've also put the if statement inside the activeMonitorInfo method and it shows the same behaviour in there.
#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.
activeMonitorInfo( X, Y, Width, Height )
Msgbox %Width%
if ( %Width% = 3200 ) {
msgbox "Width is 3200"
return
} else {
msgbox "Width is not 3200"
return
}
activeMonitorInfo( ByRef X, ByRef Y, ByRef Width, ByRef Height )
{
CoordMode, Mouse, Screen
MouseGetPos, mouseX , mouseY
SysGet, monCount, MonitorCount
Loop %monCount%
{
SysGet, curMon, Monitor, %a_index%
if ( mouseX >= curMonLeft and mouseX <= curMonRight and mouseY >= curMonTop and mouseY <= curMonBottom ) {
X := curMonTop
y := curMonLeft
Height := curMonBottom - curMonTop
Width := curMonRight - curMonLeft
return
}
}
}