; ; HideToTray ; By mmdoogie ; 24 February 2007 ; ; Hides windows to the tray with Windows-T. ; Right-click the icon and click a window to restore it. ; Or, you can choose to restore all. ; All windows are automatically restored on program exit. Menu,Tray,Add Menu,Tray,Add,Restore All,ShowAllWindows Menu,Tray,Add OnExit CleanUpOnAisle12 NumberHidden := 0 return #t:: WinGetActiveTitle,ActiveTitle WinHide,%ActiveTitle% NumberHidden := NumberHidden + 1 WindowTitle%NumberHidden% := ActiveTitle Menu,Tray,Add,%ActiveTitle%,ShowWindowFromMenu return ShowWindowFromMenu: ActiveTitle := A_ThisMenuItem ShowWindow: ShiftCount := 1 FoundIt := false Loop %NumberHidden% { if (FoundIt = false AND WindowTitle%ShiftCount% = ActiveTitle) { FoundIt := true } if (FoundIt = true) { Source := ShiftCount + 1 WindowTitle%ShiftCount% := WindowTitle%Source% } ShiftCount := ShiftCount + 1 } NumberHidden := NumberHidden - 1 Menu,Tray,Delete,%ActiveTitle% WinShow,%ActiveTitle% return ShowAllWindows: TotalLoops := NumberHidden Loop %TotalLoops% { ActiveTitle := WindowTitle1 Gosub ShowWindow } return CleanUpOnAisle12: Gosub ShowAllWindows ExitApp