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 

WinHide and WinShow Tool

 
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
joemoeschmoe



Joined: 25 Jun 2008
Posts: 25

PostPosted: Mon Dec 01, 2008 8:20 pm    Post subject: WinHide and WinShow Tool Reply with quote

Latest Version (1.1): http://www.autohotkey.net/~joemoeschmoe/WinHideShow.ahk

Here's something I've found to be quite handy - especially at work. It helps me clean up my taskbar or temporary eliminate window(s) from my view (both of which is already done pretty well with Dexpot, but this is a different angle to attack the problems from...).

Functions (SC15D is my Command Key on the right side of the keyboard):

    SC15D & Enter -- Hide Current Window and add it to hidden window list
    SC15D & / -- Show and activate "previously" hidden window (the one at the top of the list)
    SC15D & Backspace -- Show all hidden windows
    SC15D & RShift -- Display a list of hidden windows with their index next to it. If user presses 1-9, it will show and activate the window with that index.

I've also put ShowAllHiddenWindows() in both of my reloading scripts to make sure I'm not stuck with a hidden window after reloading (I'm not sure how to find a hidden window of unknown title).

Code:

;SC15D is my Command Key on the right side of the keyboard
SC15D & Enter:: ;Hide current window - add to list
   SetTitleMatchMode, 3 ;***
   if (NumHiddenWindows = "")
      NumHiddenWindows:=0
   NumHiddenWindows:=NumHiddenWindows+1
   WinGetTitle PreviousHiddenWindow, A
   HiddenWindows%NumHiddenWindows%:=PreviousHiddenWindow
   WinMinimize A
   WinHide %PreviousHiddenWindow%
   WinActivate
   ;msgbox _%NumHiddenWindows%_%PreviousHiddenWindow%
   
return ;*

SC15D & \:: ;bring back previously hidden window
   SetTitleMatchMode, 3 ;***
   ;Msgbox %PrevMinimize%
   if (PreviousHiddenWindow <> "")
   {
      WinShow %PreviousHiddenWindow%
      WinRestore %PreviousHiddenWindow%
      WinActivate %PreviousHiddenWindow%
      NumHiddenWindows:=NumHiddenWindows - 1
      PreviousHiddenWindow:=HiddenWindows%NumHiddenWindows%
   }
   
return ;*

SC15D & Backspace::ShowAllHiddenWindows() ;Show All Hidden Windows

SC15D & RShift:: ;Hidden Window List & Goto
   SetTitleMatchMode, 3 ;***
   if (NumHiddenWindows="" or NumHiddenWindows <= 0)
   {
      msgbox There are no Hidden Windows at this time.
      return
   }
   WindowList=
   Loop %NumHiddenWindows%
   {
      if (A_Index >= 10)
         WindowList:=WindowList . "...The Following windows cannot be reached directly through this...`n"
      CurWindow:=HiddenWindows%A_Index%
      ;WinShow %CurWindow%
      WindowList:=WindowList . A_Index . ") " . CurWindow . "`n"
      
   }
   
   Progress , m zh0 fs12 c00 WS550 W750
      , %WindowList%
      ,
      , Window List - Select the number you want to unhide
      
   Input, VKey_Main, L1
   progress , off

   
   if (VKey_Main >= 1 and VKey_Main <= 9)
   {
      WinToShow:=HiddenWindows%VKey_Main%
      WinShow %WinToShow%
      WinActivate %WinToShow%
      if (VKey_Main < NumHiddenWindows)
      {
         NumLoops:= NumHiddenWindows - VKey_Main
         Loop %NumLoops%
         {
            IndexToEdit:=VKey_Main + A_Index - 1
            IndexToCopy:=IndexToEdit + 1
            HiddenWindows%IndexToEdit%:=HiddenWindows%IndexToCopy%
         }
         NumHiddenWindows:=NumHiddenWindows - 1      
      }
      else
      {
         NumHiddenWindows:=NumHiddenWindows - 1
         PreviousHiddenWindow:=HiddenWindows%NumHiddenWindows%
      }
      
   }
   
return ;*

ShowAllHiddenWindows()
{
   global NumHiddenWindows
   global HiddenWindows
   SetTitleMatchMode, 3
   ;msgbox _%NumHiddenWindows%_
   if (NumHiddenWindows="" or NumHiddenWindows <= 0)
      return
   Loop %NumHiddenWindows%
   {
      CurWindow:=HiddenWindows%A_Index%
      ;msgbox %CurWindow%
      WinShow %CurWindow%
      WinRestore %CurWindow%
      WinActivate %CurWindow%
   }
   NumHiddenWindows:=0
}



Comments?[/url]


Last edited by joemoeschmoe on Thu Dec 04, 2008 7:46 pm; edited 1 time in total
Back to top
View user's profile Send private message
WindowHide
Guest





PostPosted: Thu Dec 04, 2008 10:08 am    Post subject: Reply with quote

Could be useful. But it would be great if I could hide window by double clicking on title bar. Would this be difficult to add?

Thanks!
Back to top
joemoeschmoe



Joined: 25 Jun 2008
Posts: 25

PostPosted: Thu Dec 04, 2008 7:49 pm    Post subject: Reply with quote

WindowHide wrote:
Could be useful. But it would be great if I could hide window by double clicking on title bar. Would this be difficult to add?

Thanks!


I don't know how to do this, but I imagine it would involve looking for a click and then briefly waiting for another click. However, I don't know how you would tell if the top bar of the window has been recognized. Double clicking the top of the window maximizes the window regularly, so this might not be the best thing. I'm not inclined to make this feature because I like to use the mouse as little as possible.
Back to top
View user's profile Send private message
joemoeschmoe



Joined: 25 Jun 2008
Posts: 25

PostPosted: Thu Dec 04, 2008 8:16 pm    Post subject: Reply with quote

I've updated the script so when its reloaded, there's no need to pull out all the currently hidden windows because it now stores them in an ini file instead of an array.
Back to top
View user's profile Send private message
menaphus



Joined: 28 Nov 2008
Posts: 111
Location: United Kingdom

PostPosted: Fri Dec 05, 2008 5:39 pm    Post subject: Reply with quote

WindowHide wrote:
Could be useful. But it would be great if I could hide window by double clicking on title bar. Would this be difficult to add?

Thanks!

I'd say adding a fairly large GUI in the corner with a massive hide all button that is always ontop would be best for triggering hide(aswell as hotkeys).
I think there is one like this already on the forum
_________________
Adam
http://moourl.com/8w0tx
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Wouther



Joined: 01 May 2007
Posts: 83
Location: The Netherlands

PostPosted: Mon Dec 08, 2008 9:22 pm    Post subject: Reply with quote

joemoeschmoe wrote:
I don't know how to do this, but I imagine it would involve looking for a click and then briefly waiting for another click. However, I don't know how you would tell if the top bar of the window has been recognized.
Take a look at this post by shimanov. It detects what part of a window has been clicked. Values that can be used are: (found in a post by evl)
Code:
/*
      #define HTERROR             (-2)
      #define HTTRANSPARENT       (-1)
      #define HTNOWHERE           0
      #define HTCLIENT            1
      #define HTCAPTION           2
      #define HTSYSMENU           3
      #define HTGROWBOX           4
      #define HTSIZE              HTGROWBOX
      #define HTMENU              5
      #define HTHSCROLL           6
      #define HTVSCROLL           7
      #define HTMINBUTTON         8
      #define HTMAXBUTTON         9
      #define HTLEFT              10
      #define HTRIGHT             11
      #define HTTOP               12
      #define HTTOPLEFT           13
      #define HTTOPRIGHT          14
      #define HTBOTTOM            15
      #define HTBOTTOMLEFT        16
      #define HTBOTTOMRIGHT       17
      #define HTBORDER            18
      #define HTREDUCE            HTMINBUTTON
      #define HTZOOM              HTMAXBUTTON
      #define HTSIZEFIRST         HTLEFT
      #define HTSIZELAST          HTBOTTOMRIGHT
      #if(WINVER >= 0x0400)
      #define HTOBJECT            19
      #define HTCLOSE             20
      #define HTHELP              21
*/

_________________
Printing css/html-formatted text
Back to top
View user's profile Send private message
menaphus



Joined: 28 Nov 2008
Posts: 111
Location: United Kingdom

PostPosted: Tue Dec 09, 2008 4:34 pm    Post subject: A suggestion Reply with quote

I actualy have a suggestion to anyone developing this or similar, it should do basicaly the same thing but it should do these:

Have an invizsible box over the are in the screen where the X of the window is

All windows automaticaly maximized

A window is hidden instead of closed when clicking over the X now

-

So that basicaly if you click X in panic then if the window would otherwise take ages to end it would hide it and mute the pc. There should also be a password protected method when getting the hidden windows back or closing the script.


; on a related note, do the windows re-appear when the script ends?
_________________
Adam
http://moourl.com/8w0tx
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions 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