TVClose() - Close GUI like a TV shutdown
Posted: 10 Jan 2014, 19:38
This is a very simple idea and code. Just decrease height then decrease width, that's it. See GIF image below:
TVClose()
Sample 1:
Sample 2: (by joedf)
A much better version by AfterLemon --> viewtopic.php?f=6&t=1370#p10497
TVClose()
Code: Select all
TVClose(HideAndRestore = False, H_ReduceCount = 2, W_ReduceCount = 2)
{
Gui, %A_Gui%:+LastFound
WinGetPos, x, y, w, h
p := HideAndRestore ? [x, y, w, h] : "" ; Backup GUI position
; Decrease height (keep 3 pixels)
Step := (h - 3) / H_ReduceCount
Loop, % H_ReduceCount
{
y += Step / 2 ; Moving down
h -= Step ; Decreasing height
WinMove,,,, %y%,, %h%
}
; Decrease Width (keep 3 pixels)
Step := (w - 3) / W_ReduceCount
Loop, % W_ReduceCount
{
x += Step / 2 ; Moving right
w -= Step ; Decreasing width
WinMove,,, %x%,, %w%
}
if HideAndRestore
{
Gui, %A_Gui%:Hide
WinMove,,, % p.1, % p.2, % p.3, % p.4 ; Restore GUI position
}
}
Code: Select all
Gui, Show, w1000 h500
Return
GuiClose:
TVClose(True, 30, 10)
Return
; GuiClose:
; TVClose()
; ExitApp
Code: Select all
Gui, Show, w1000 h500
Return
GuiClose:
SetWinDelay, 10
TVClose(False, 6, 6)
ExitApp