WinRegion
hold t, press 8, [define new window size with mouse], release tunknown
autohotkey
8 months ago
1.5 kB
9
Indexable
return
~t::
zKeyT:= 1
return
~t Up::
zKeyT:= 0
return
~8::
if(zKey8=1)
return
zKey8:= 1
if(zKeyT=0)
return
CoordMode, Mouse, Screen
CoordMode, Tooltip, Screen
;setting...
MouseGetPos, mX, mY
wx1:=mX
wy1:=mY
tooltip,top-left %mX% %mY%`nAwaiting 't' (bottom-right)..., mX,mY,2
keywait, t
tooltip
MouseGetPos, mX, mY
;if same position.. restore the window..
if(wx1=mX)
{
WinSet, Region,, A
DllCall("dwmapi\DwmSetWindowAttribute", "ptr", WinExist("A")
, "uint", DWMWA_NCRENDERING_POLICY := 2, "int*", DWMNCRP_ENABLED := 2, "uint", 4)
tooltip,,,,2
exit
}
if(wy1=mY)
{
WinSet, Region,, A
DllCall("dwmapi\DwmSetWindowAttribute", "ptr", WinExist("A")
, "uint", DWMWA_NCRENDERING_POLICY := 2, "int*", DWMNCRP_ENABLED := 2, "uint", 4)
tooltip,,,,2
exit
}
wx2:=mX
wy2:=mY
tooltip,bottom-right %mX% %mY%, mX,mY,3
WinGetPos, wx3, wy3,,,A
MouseGetPos, mX, mY
xPosition:=mX-wx1-(wx2/2)
yPosition:=mY-wy1-(wy2/2)
wx2:=wx2-wx1 ;width
wy2:=wy2-wy1 ;height
wx1:=wx1-wx3 ;regionalize
wy1:=wy1-wy3 ;regionalize
;WinSet, SubCommand, Value [, WinTitle, WinText, ExcludeTitle, ExcludeText]
DllCall("dwmapi\DwmSetWindowAttribute", "ptr", WinExist("A")
, "uint", DWMWA_NCRENDERING_POLICY := 2, "int*", DWMNCRP_DISABLED := 1, "uint", 4)
WinSet, Region, %wx1%-%wy1% W%wx2% H%wy2%, A
tooltip,,,,2
tooltip,,,,3
return
~8 Up::
zKey8:= 0
return
Editor is loading...
Leave a Comment