How do I center a window?

Get help with using AutoHotkey and its commands and hotkeys
BruceO
Posts: 2
Joined: 06 Sep 2019, 11:15

How do I center a window?

06 Sep 2019, 12:51

New to this scripting process and am look for help in creating a script to center any window on the desktop. Window may or may not be active. Any help will be grateful.
User avatar
TheDewd
Posts: 1391
Joined: 19 Dec 2013, 11:16
Location: USA

Re: How do I center a window?

06 Sep 2019, 15:34

Code: Select all

F1::
	WinTitle = A
	SysGet, Display_, Monitor, 1
	WinGetPos,,, WinW, WinH, % WinTitle
	WinMove, % WinTitle,, % Floor( (Display_Right/2)-(WinW/2) ), % Floor( (Display_Bottom/2)-(WinH/2) )
return

https://www.autohotkey.com/boards/viewtopic.php?p=40398#p40398
https://www.google.com/search?q=site:autohotkey.com+center+a+window
Image Bulldozer - Sokoban inspired game from 1994 recreated in AutoHotkey.

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], boiler, JackMa, rpgfreak128 and 268 guests