This is my script right now:
Code: Select all
+#z:: ;; left half screen
#z:: ;; right half screen
hWnd := WinExist("A")
WinGet, MinMax, MinMax
if MinMax
WinRestore
WinGetPos,, Y_TaskBar,,, ahk_class Shell_TrayWnd
dX := dW := dH := 0
VarSetCapacity(RECT, 16, 0)
if DllCall("Dwmapi\DwmGetWindowAttribute", Ptr, hWnd, UInt, DWMWA_EXTENDED_FRAME_BOUNDS := 9, Ptr, &RECT, UInt, 16) = 0 {
WinGetPos, X, Y, W, H
dX := NumGet(RECT, "Int") - X
dW := X + W - NumGet(RECT, 8, "Int") + dX
dH := Y + H - NumGet(RECT, 12, "Int")
}
WinMove,,, (A_ThisHotkey = "+#z" ? 0 : A_ScreenWidth//2) - dX, 0, A_ScreenWidth//2 + dW, Y_TaskBar + dH
Return
Thans for your help.
[Mod edit: Added [code][/code] tags. Please use them yourself when posting code.]
[Mod action: Topic moved from "Scripts and Functions (v1)" which is for sharing working scripts, not for asking for help with your scripts.]