0

Credit to @Jeff Axelrod for the solution I need a modification to. I cannot figure out how to alter this so that it "respects" the windows taskbar I keep on the left side of my left monitor. I have a number of custom toolbars in my Win 7 taskbar and so it's a couple inches wide. The code below maximizes the current window across both monitors, but a portion of that expanded window is therefore underneath my taskbar.

+#Up::
WinGetActiveTitle, Title
WinRestore, %Title%
SysGet, X1, 76
SysGet, Y1, 77
SysGet, Width, 78
SysGet, Height, 79
WinMove, %Title%,, X1, Y1, Width, Height
return

I'm sure I'm missing something simple here but it's been one of those days :-)

Here's a screenshot which shows how the window is underneath my taskbar. Please refer to the upper left corner where it is most obvious that the maximized window is underneath:

screenshot of window "not respecting" taskbar

Community
  • 1
  • 1
AMM
  • 135
  • 1
  • 2
  • 7

1 Answers1

1

You are looking for the MonitorWorkArea, namely the MonitorWorkAreaLeft by the looks of your screenshot.

Script to get all monitor info:

SysGet, MonitorCount, MonitorCount
SysGet, MonitorPrimary, MonitorPrimary
Message .= "Monitor Count:`t" MonitorCount "`nPrimary Monitor:`t" MonitorPrimary
Loop, %MonitorCount%
{
    SysGet, MonitorName, MonitorName, %A_Index%
    SysGet, Monitor, Monitor, %A_Index%
    SysGet, MonitorWorkArea, MonitorWorkArea, %A_Index%
    Message .= "`n`nMonitor:`t#" A_Index "`nName:`t" MonitorName "`nLeft:`t" MonitorLeft "(" MonitorWorkAreaLeft " work)`nTop:`t" MonitorTop " (" MonitorWorkAreaTop " work)`nRight:`t" MonitorRight " (" MonitorWorkAreaRight " work)`nBottom:`t" MonitorBottom "(" MonitorWorkAreaBottom " work)"
}

msgbox % Message

Once you find the correct monitor you would like to use, use the value for coordinates:

SysGet, MonitorWorkArea, MonitorWorkArea, 2
msgbox % MonitorWorkAreaLeft

EDIT

This will grab the values and move the window each time you run it.

SysGet, MonitorWorkArea, MonitorWorkArea, 1 ; Leftmost monitor
X1 := MonitorWorkAreaLeft
Y1 := MonitorWorkAreaTop
SysGet, MonitorWorkArea, MonitorWorkArea, 2 ; Rightmost monitor
Width := MonitorWorkAreaRight - X1
Height := MonitorWorkAreaBottom

WinGetActiveTitle, Title
WinMove, % Title,, % X1, % Y1, % Width, % Height
Elliot DeNolf
  • 2,920
  • 1
  • 15
  • 12
  • Thank you! Because I'm still learning, I'm not sure if I'll phrase this correctly: Would it be possible to use your script somehow in the expressions to create the values for `X1`, `Y1`, `Width` and `Height` so that each time the script runs it has the latest values? – AMM Jul 22 '13 at 18:56
  • The script gets the values each time you run it. I guess I don't follow what you are asking. – Elliot DeNolf Jul 22 '13 at 19:12
  • Sorry! This is where my lack of knowledge is getting in the way! I modified the original script in my Question by deleting the expressions then manually entering the values obtained from your script : `WinMove, %Title%,, 202, 0, 2998, 900`. I'm wondering if I could instead use your script to create values for the variables so that each time I press `+#Up` it checks for correct values first. – AMM Jul 22 '13 at 19:29