归功于@Jeff Axelrod solution I need a modification to。我无法弄清楚如何改变它,以便它“尊重”我保留在左侧监视器左侧的Windows任务栏。我的Win 7任务栏中有许多自定义工具栏,所以它只有几英寸宽。下面的代码最大化了两个监视器的当前窗口,但是扩展窗口的一部分因此位于我的任务栏下面。
+#Up::
WinGetActiveTitle, Title
WinRestore, %Title%
SysGet, X1, 76
SysGet, Y1, 77
SysGet, Width, 78
SysGet, Height, 79
WinMove, %Title%,, X1, Y1, Width, Height
return
我确信我在这里缺少一些简单的东西,但那是其中一天: - )
这是一个屏幕截图,显示了窗口在我的任务栏下面的方式。请参阅左上角,最明显的是最大化窗口位于下方:
答案 0 :(得分:1)
您正在寻找MonitorWorkArea
,即屏幕截图的MonitorWorkAreaLeft
。
获取所有监视器信息的脚本:
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
找到想要使用的正确显示器后,请使用坐标值:
SysGet, MonitorWorkArea, MonitorWorkArea, 2
msgbox % MonitorWorkAreaLeft
修改强>
这将获取值并在每次运行时移动窗口。
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