Last active
July 2, 2024 17:48
-
-
Save zemax/7337507 to your computer and use it in GitHub Desktop.
An AutoHotKey script to move & resize windows screen when pressing Win + Alt + Left or Win + Alt + Right.
Window moves from 33% Left > 50% Left > 66% Left > 66% Right > 50% Right > 33% Right
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
;******************************************************************************** | |
; Move Windows by 1/3 | |
;******************************************************************************** | |
MoveCycle(Add) { | |
static SizeCycle = 0 | |
SizeCycle := Mod(SizeCycle + Add, 6) | |
if (SizeCycle < 0) { | |
SizeCycle := SizeCycle + 6 | |
} | |
if (SizeCycle = 0) { | |
MoveWindow(0, 33.3333) | |
} | |
else if (SizeCycle = 1) { | |
MoveWindow(0, 50) | |
} | |
else if (SizeCycle = 2) { | |
MoveWindow(0, 66.6666) | |
} | |
else if (SizeCycle = 3) { | |
MoveWindow(33.3333, 66.6666) | |
} | |
else if (SizeCycle = 4) { | |
MoveWindow(50, 50) | |
} | |
else if (SizeCycle = 5) { | |
MoveWindow(66.6666, 33.3333) | |
} | |
} | |
MoveWindow(XP, WP) { | |
;Get current Window | |
WinGetActiveTitle, WinTitle | |
WinGetPos, X, Y, WinWidth, WinHeight, %WinTitle% | |
;Get Taskbar height | |
WinGetPos,,, tbW, tbH, ahk_class Shell_TrayWnd | |
;Calculate new position and size | |
XNew := (A_ScreenWidth * XP / 100) | |
WNew := (A_ScreenWidth * WP / 100) | |
HNew := (A_ScreenHeight - tbH) | |
;MsgBox, %XNew% - %WNew% | |
WinRestore, %WinTitle% | |
WinMove, %WinTitle%,, %XNew%, 0, %WNew%, %HNew% | |
} | |
#!Left:: | |
MoveCycle(-1) | |
return | |
#!Right:: | |
MoveCycle(1) | |
return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is exactly what I was looking for! Thank you!!!
Since by default (without a script), the Windows Key + Arrow Key does 50/50, I think I will modify this script to skip the 50% setting and only do the 1/3 and 2/3 settings.