AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Minimizing all windows except MyWindow (AutoHotkeyGUI)

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
madufo



Joined: 22 Dec 2008
Posts: 9

PostPosted: Thu May 07, 2009 8:43 pm    Post subject: Minimizing all windows except MyWindow (AutoHotkeyGUI) Reply with quote

It is driving me crazy. May be I am to dump!


What it should do:
Button on MyWindow (AutoHotkeyGUI) should minimize all windows except the MyWindow itself.


What it does:
It is minimizing MyWindow also.


Question:
What can I do to get the desired behavior?


Code:

;-----------------------------
   Gui, Add, Button, w200 gHide, Hide Windows
   Gui, Add, Button, w200 gShow, Show Windows
   Gui, Show, , MyWindow
   Return
;-----------------------------
   Hide:
   WinGet, id, list,,,
   Loop, %id%
   {   
      this_id := id%A_Index%
      WinGetClass, this_class, ahk_id %this_id%
      WinGetTitle, this_title, ahk_id %this_id%
      If (this_class <> "Shell_TrayWnd") and (this_class <> "Button") and (this_class <> "Progman") and (this_class <> "AutoHotkeyGUI") and (this_title <> "MyWindow")
      {
         MinWin=|%this_class% %this_title%%MinWin%
         WinSet, Transparent, 0, ahk_id %this_id%
         WinMinimize, %this_title%
         WinSet, Transparent, 255, ahk_id %this_id%
      }
      Else
      {   
         UntouchedWin=|%this_class% %this_title%%UntouchedWin%
      }
   }
   MsgBox ------------------------Untouched Windows------------------------`n`n%UntouchedWin%`n`n`n`n------------------------Touched Windows------------------------`n`n%MinWin%
   Return
;-----------------------------
   Show:
   WinGet, id, list,,,
   Loop, %id%
   {   
      this_id := id%A_Index%
      WinGetClass, this_class, ahk_id %this_id%
      WinGetTitle, this_title, ahk_id %this_id%
      IfInString, MinWin, %this_class% %this_title%
      {
         WinRestore, %this_title%
      }
   }
   Return
;-----------------------------
   GuiClose:
   GuiEscape:
   ExitApp




Last edited by madufo on Thu May 07, 2009 9:32 pm; edited 1 time in total
Back to top
View user's profile Send private message
34t



Joined: 07 May 2009
Posts: 13

PostPosted: Thu May 07, 2009 8:47 pm    Post subject: Reply with quote

By hiding, do you mean minimizing?

You can try first executing Windows+D to minimize all windows and then activating MyWindows so it's back up?

Just an idea Exclamation
Back to top
View user's profile Send private message
Carcophan



Joined: 24 Dec 2008
Posts: 1308
Location: :noitacoL

PostPosted: Thu May 07, 2009 8:58 pm    Post subject: Reply with quote

34t wrote:
By hiding, do you mean minimizing?

You can try first executing Windows+D to minimize all windows and then activating MyWindows so it's back up?

Just an idea Exclamation


Mad you beat me by 10 seconds
Back to top
View user's profile Send private message
MasterFocus



Joined: 08 Apr 2009
Posts: 3035
Location: Rio de Janeiro - RJ - Brasil

PostPosted: Thu May 07, 2009 9:01 pm    Post subject: Reply with quote

EDIT: nevermind, I stated something stupid Confused

Last edited by MasterFocus on Thu May 07, 2009 9:07 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
JDN



Joined: 24 Mar 2004
Posts: 299

PostPosted: Thu May 07, 2009 9:05 pm    Post subject: Reply with quote

There is a command called WinMinimizeAll. Does that help you?

There is also a command called WinHide.

Maybe that is what you have in mind?

WinHide WinMinimizeAll
Back to top
View user's profile Send private message
madufo



Joined: 22 Dec 2008
Posts: 9

PostPosted: Thu May 07, 2009 9:44 pm    Post subject: Reply with quote

34t wrote:

By hiding, do you mean minimizing?


Yes I do. That is the reason why I edited the subject. Sorry for this.

34t wrote:

You can try first executing Windows+D to minimize all windows and then activating MyWindows so it's back up?


I was thinking about this. But I don't want to flicker (minimize/restore) the MyWindow while it provides the main gui.

JDN wrote:

There is a command called WinMinimizeAll. Does that help you?
There is also a command called WinHide.


Your first suggestion is what I don't want to do. See above please.
Your second suggestion is what I realized with the WinMinimize command.
But I can not prevent the MyWindow from being minimized.

Thank you so far.

Any other suggestions?´

madufo
Back to top
View user's profile Send private message
JDN



Joined: 24 Mar 2004
Posts: 299

PostPosted: Thu May 07, 2009 10:57 pm    Post subject: Reply with quote

I found a terrific section of code that may be of help to you.

I had been wondering lately how I could find all Windows on my desktop. I think that may be the solution to your problem.

Perhaps you need to visit each window in turn and minimize them all except for your window.

To do this, see the documentation for the WinGet command. There is a snippet there which demonstrates how to visit all windows on the desktop.

WinGet

Here it is:

Code:

; Example #2: This will visit all windows on the entire system and display info about each of them:
WinGet, id, list,,, Program Manager
Loop, %id%
{
    this_id := id%A_Index%
    WinActivate, ahk_id %this_id%
    WinGetClass, this_class, ahk_id %this_id%
    WinGetTitle, this_title, ahk_id %this_id%
    MsgBox, 4, , Visiting All Windows`n%a_index% of %id%`nahk_id %this_id%`nahk_class %this_class%`n%this_title%`n`nContinue?
    IfMsgBox, NO, break
}
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group