summaryrefslogtreecommitdiff
path: root/_winresize.ahk
blob: 14389f3d554dc98c7d5b023fb9c5f6c0701b569b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#NoEnv
#Warn
SendMode Input
SetWorkingDir %A_ScriptDir%

; Not only windows titlebar and borders count towards window size
; shadow also does, so compensate for that, width 16, height 39

ResizeWin(Width = 0,Height = 0,ExtraW = 0,ExtraH = 0,WinW = 16,WinH = 39) {
  WinGetPos,X,Y,W,H,A

  if (Width == 0) {
    Width := W
  } else {
    Width += ExtraW + WinW
  }
  if (Height == 0) {
    Height := H
  } else {
    Height += ExtraH + WinH
  }

  WinMove,A,,%X%,%Y%,%Width%,%Height%
}