Move all windows to primary monitor and maximize

Get help with using AutoHotkey and its commands and hotkeys
shadowsong
Posts: 1
Joined: 17 Jun 2019, 13:50

Move all windows to primary monitor and maximize

24 Jun 2019, 12:52

When I dock/undock my laptop, I often end up with formerly maximized windows resized to be ALMOST the same size as the screen, but not quite. And sometimes when I undock, windows that were on my second monitor don't get moved to the laptop screen, and I have to futz with keyboard shortcuts for moving them until I can actually see them again.

I wrote some code that theoretically would do this, but it doesn't actually do anything when I run it. Can anyone help me with this?

Code: Select all

;move all windows to main monitor and maximize
#PgUp:: 
SysGet, Coord, monitor		;find coordinates of main monitor
WinMinimizeAllUndo		;restore all
UniqueID := WinExist("A") 	;store active window
WinActivateBottom, i)[a-z]*	;activate oldest window
while UniqueID <> WinExist("A") ;until you loop back to the stored window
	{
	WinMove, %CoordLeft%, %CoordTop%	;move to main monitor
	WinMaximize, A 				;maximize
	WinActivateBottom, i)[a-z]*		;activate next oldest
	}

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], pond_pop, Tom Harding and 210 guests