Stilez Posted July 31, 2011 Posted July 31, 2011 (edited) I was playing round with WinMinimizeAll() and WinMinimizeAllUndo(). If you have popup dialogs etc in between, sometimes the WinMinimizeAllUndo() "forgets" which windows were minimized by WinMinimizeAll() so it doesn't do the restore function as you'd expect. For anyone who hits this, the following code will handle it - and allow arbitrary window manipulation in between. It logs all non-minimized window handles, and when you're done, it checks for any windows that are displayed now, were displayed before (according to its handle) and whose state has changed from non-minimized to minimized, and restores it. Things it doesn't do - it doesn't handle clashes of window handles, and it doesn't remember the active window (their Z-order). If anyone wants to fix for those, please do! #Include <Array.au3> dim $OriginalNonMinimizedWindows[1] $OriginalNonMinimizedWindows[0]="" $winlist = WinList() If $winlist[0][0] > 0 Then for $i = 1 to $winlist[0][0] $winhdl = $winlist[$i][1] $state = WinGetState($winhdl) If BitAND($state,16) <> 16 Then _ArrayAdd($OriginalNonMinimizedWindows, $winhdl) Next EndIf _ArraySort($OriginalNonMinimizedWindows) WinMinimizeAll() sleep (1500) $winlist = Winlist() If $winlist[0][0] > 0 Then For $i = 1 to $winlist[0][0] $winhdl = $winlist[$i][1] $state = WinGetState($winhdl) If BitAND($state, 16) == 16 Then If _ArrayBinarySearch($OriginalNonMinimizedWindows, $winhdl) >= 0 Then WinSetState($winhdl, "", @SW_RESTORE) msgbox(1,"","Restored window for: " & $winlist[$i][0] & " (handle "& $winlist[$i][1] & ").", 1) EndIf EndIf Next EndIf Edited July 31, 2011 by Stilez
JoeP8 Posted November 8, 2017 Posted November 8, 2017 Hi, I know this is an old post.. 6 years ago. Your code worked well for me, except I stopped Explorer process. All the windows restored, except an open Folder. Its not really a problem, I'm just curious as to how to save info for an open folder to be restored.
Developers Jos Posted November 8, 2017 Developers Posted November 8, 2017 Not sure you are in a hurry for an answer from @Stilez, but he's not been visiting the forum since august 2011. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
JoeP8 Posted November 9, 2017 Posted November 9, 2017 (edited) oh I see. Well, I may try to find out, or remain curious. I suppose I would have to detect if a window is a folder. Then save the information and then figure out code to open a folder. Probably with a lot of google searching. Hey, opening a folder isn't so difficult. Now to find out how to save the info. Edited November 9, 2017 by JoeP8 more related info
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now