diff --git a/apps/zipper.ps1 b/apps/zipper.ps1 index d937747..9c775f5 100644 --- a/apps/zipper.ps1 +++ b/apps/zipper.ps1 @@ -515,7 +515,7 @@ function Invoke-Unzip { } # ===================================================================== -# WINDOW LAYOUT (fails silently): this window right + on top, Explorer left +# WINDOW LAYOUT (fails silently): this window right, Explorer left # ===================================================================== $WinApi = @' using System; @@ -561,7 +561,7 @@ function Set-WindowLayout { $root = [ZipperWin]::GetAncestor($console, 3) if ($root -ne [IntPtr]::Zero) { $console = $root } [void][ZipperWin]::ShowWindow($console, 9) - [void][ZipperWin]::SetWindowPos($console, [IntPtr](-1), $area.Right - $width, $area.Top, $width, $height, 0x40) + [void][ZipperWin]::SetWindowPos($console, [IntPtr]::Zero, $area.Right - $width, $area.Top, $width, $height, 0x40) } $windows = [ZipperWin]::ExplorerWindows() @@ -578,14 +578,6 @@ function Set-WindowLayout { } catch { return [IntPtr]::Zero } } -function Reset-WindowLayout($console) { - try { - if ($console -and $console -ne [IntPtr]::Zero) { - [void][ZipperWin]::SetWindowPos($console, [IntPtr](-2), 0, 0, 0, 0, 0x13) # not topmost; keep size/position - } - } catch {} -} - # ===================================================================== # MENU # ===================================================================== @@ -651,38 +643,34 @@ function Set-WindowRight { # <<< layout Set-WindowRight Clear-Host -$Console = Set-WindowLayout +[void](Set-WindowLayout) $SevenZip = $null $last = '' -try { - $Settings = Import-Settings - while ($true) { - Say "" - Say " =============================================" 'Cyan' - Say " ZIPPER" 'Cyan' - Say " =============================================" 'Cyan' - Say "" - Say " 1 - Zip" 'White' - Say " 2 - Unzip" 'White' - Say " 3 - Settings" 'White' - Say " 0 - Quit" 'White' - Say "" - $choice = Read-MenuKey 'Choose 0-3' '0123' $last - if ($choice -eq '0') { break } - if ($choice -eq '3') { - if (@(Show-Settings) -contains 'quit') { break } - Clear-Host - continue - } - if (-not $SevenZip) { $SevenZip = Get-SevenZip } - if ($SevenZip) { - if ($choice -eq '1') { Invoke-Zip } else { Invoke-Unzip } - } - $last = $choice - Say "" +$Settings = Import-Settings +while ($true) { + Say "" + Say " =============================================" 'Cyan' + Say " ZIPPER" 'Cyan' + Say " =============================================" 'Cyan' + Say "" + Say " 1 - Zip" 'White' + Say " 2 - Unzip" 'White' + Say " 3 - Settings" 'White' + Say " 0 - Quit" 'White' + Say "" + $choice = Read-MenuKey 'Choose 0-3' '0123' $last + if ($choice -eq '0') { break } + if ($choice -eq '3') { + if (@(Show-Settings) -contains 'quit') { break } + Clear-Host + continue } -} finally { - Reset-WindowLayout $Console + if (-not $SevenZip) { $SevenZip = Get-SevenZip } + if ($SevenZip) { + if ($choice -eq '1') { Invoke-Zip } else { Invoke-Unzip } + } + $last = $choice + Say "" } # Quit closes this window, not just the menu (errors above skip this and leave it open) [Environment]::Exit(0)