Created
March 26, 2025 10:10
-
-
Save Satal/4912d5aa00638d4c31e38f7d088fc595 to your computer and use it in GitHub Desktop.
This script allows you to easily resize any window on your screen using a AHK v2 keyboard shortcut.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ^+w:: { ; Ctrl + Shift + W | |
| MsgBox("Hover your mouse over the window you want to resize, then press OK.") | |
| ; Get the window under the mouse | |
| MouseGetPos(, , &winID) | |
| WinGetPos(&x, &y, &width, &height, "ahk_id " winID) | |
| MsgBox("Current Size:`nWidth: " width "`nHeight: " height) | |
| ; Get new width | |
| resultWidth := InputBox("Enter the new width:", "New Width") | |
| if resultWidth.Result != "OK" || resultWidth.Value = "" | |
| return | |
| newWidth := Number(resultWidth.Value) | |
| ; Get new height | |
| resultHeight := InputBox("Enter the new height:", "New Height") | |
| if resultHeight.Result != "OK" || resultHeight.Value = "" | |
| return | |
| newHeight := Number(resultHeight.Value) | |
| ; Resize window | |
| WinMove(x, y, newWidth, newHeight, "ahk_id " winID) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment