AutoHotkey Community

It is currently May 26th, 2012, 1:37 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: WinHide and WinShow Tool
PostPosted: December 1st, 2008, 9:20 pm 
Offline

Joined: June 25th, 2008, 2:31 pm
Posts: 25
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 December 4th, 2008, 8:46 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 4th, 2008, 11:08 am 
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!


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 4th, 2008, 8:49 pm 
Offline

Joined: June 25th, 2008, 2:31 pm
Posts: 25
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 4th, 2008, 9:16 pm 
Offline

Joined: June 25th, 2008, 2:31 pm
Posts: 25
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 5th, 2008, 6:39 pm 
Offline

Joined: November 29th, 2008, 12:35 am
Posts: 111
Location: United Kingdom
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
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 8th, 2008, 10:22 pm 
Offline

Joined: May 1st, 2007, 8:36 pm
Posts: 83
Location: The Netherlands
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject: A suggestion
PostPosted: December 9th, 2008, 5:34 pm 
Offline

Joined: November 29th, 2008, 12:35 am
Posts: 111
Location: United Kingdom
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
Image


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 15 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group