Page 1 of 1

Close tabs on exit button when minimize to tray enabled

Posted: 25 Aug 2026 10:54
by lavshyak
Close all tabs and forget tree state on exit button when minimize to tray enabled, I use "minimize to tray" only so it opens quickly next time.

Re: Close tabs on exit button when minimize to tray enabled

Posted: 25 Aug 2026 15:45
by Native2904
Hi, normally with XYplorer you can script pretty much everything yourself. If there isn't a command for something, you can create a button and assign a script (ID) to it, which can then execute several commands one after another in a single step.

For what you want, it should be something like:

- Optimize Tree
- tab([closeothers])
- exit

Hope this helps you a little further.

Re: Close tabs on exit button when minimize to tray enabled

Posted: 08 Sep 2026 03:27
by lavshyak

Code: Select all

focus "P1";
  goto "%computer%";
  tab("closeothers");
  #484;
  focus "P2";
  goto "%computer%";
  tab("closeothers");
  #484;
  focus "P1";
  run """%WINDIR%\System32\WindowsPowerShell\v1.0\powershell.exe"" -NoProfile -ExecutionPolicy Bypass -File ""C:\XyplorerExit.ps1"" <hwnd>";
 

Code: Select all

try {
    Add-Type @'
using System;
using System.Runtime.InteropServices;

public class Win32 {
    [DllImport("user32.dll")]
    public static extern IntPtr SendMessage(
        IntPtr hWnd,
        uint Msg,
        IntPtr wParam,
        IntPtr lParam
    );
}
'@

    $hwnd = [IntPtr]([Int64]$args[0])

    Write-Host "HWND: $hwnd"

    if ($hwnd -eq [IntPtr]::Zero) {
        throw "Invalid HWND"
    }

    $result = [Win32]::SendMessage(
        $hwnd,
        0x0112,
        [IntPtr]0xF060,
        [IntPtr]0
    )

    Write-Host "Result: $result"
}
catch {
    Write-Host ""
    Write-Host "ERROR:" -ForegroundColor Red
    Write-Host $_.Exception.Message -ForegroundColor Red
    Write-Host ""
    Write-Host $_.ScriptStackTrace
}

Re: Close tabs on exit button when minimize to tray enabled

Posted: 12 Sep 2026 04:33
by jupe
It seems like just disabling these would fulfill your request:

Configuration | General | Startup & Exit | Save Settings | Include most-recently-used lists on save >> [ ] Tabs
Configuration | General | Tree and List | Tree | [ ] Remember state of tree