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 

Poofer! quickly and completely hide your windows!

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



Joined: 07 May 2008
Posts: 35
Location: In your Internets

PostPosted: Tue May 13, 2008 1:37 am    Post subject: Poofer! quickly and completely hide your windows! Reply with quote

Quickly hide your windows with this AHK script. Displays hidden windows in a table.



V1.0NEW!
Added ability to use custom hotkeys!
Writes to INI file @ desktop
Cant poof start menu D:

V.5a
Added Ability to hide fullscreen windows and stubborn titlebar-less windows. Also Minimize animation.

V.5
Added Hotkey, ^+Mbutton to hide restore script window.
Added ability to double click list item and restore program.
Fixed Listview to update and reflect changes.

V.02
Added ability to restore all hidden windows on close!

V.01
^+Lbutton:: Hides clicked window.
^+Rbutton:: Restores previously hidden window.

Note:
Supports up to 12 windows! Works well with most games too Very Happy

Todo: NEW!
Ability to mute certain windows, eg: games, firefox windows, etc.. Wink
If theres enough requests ill add in a feature to save the poofed windows on program exit.

Code:
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
;#InstallKeybdHook ; Install Keyboard Hook
;#UseHook ON ; Turn Hook On
#notrayicon
#Persistent
#SingleInstance FORCE
DetectHiddenWindows, On
DetectHiddenText, on
StringCaseSense On
hotkeynames=Hk_Hide,Hk_Show,Hk_Toggle
keynames=Key_Hide,Key_Show,Key_Toggle
;SetTimer,UPDATEDSCRIPT,2000
if FileExist("%A_Desktop%\Poofer.ini")
Gosub,GetKeys
else
{
   Key_Hide=^+LButton
   Key_Show=^+RButton
   Key_Toggle=^+MButton
   IniWrite,%Key_Hide%,%A_Desktop%\Poofer.ini,Hotkeys,Hide
   IniWrite,%Key_Show%,%A_Desktop%\Poofer.ini,Hotkeys,Show
   IniWrite,%Key_Toggle%,%A_Desktop%\Poofer.ini,Hotkeys,Toggle
}
num=0
maxnum=12
lastnum=0
show=1
Gosub, Start
WinGet, active_id, ID, A
return

UPDATEDSCRIPT:
FileGetAttrib,attribs,%A_ScriptFullPath%
IfInString,attribs,A
{
   Loop %num%
   {
     LV_GetText(restore,A_Index,3)
     WinRestore, ahk_id %restore%
     WinShow, ahk_id %restore%
   }
     FileSetAttrib,-A,%A_ScriptFullPath%
     SplashTextOn,,,Updated script,
     Sleep,500
     Reload
}
Return


Hide:
MouseGetPos, , , id, control
WinGetTitle, title, ahk_id %id%
WinGetClass, class, ahk_id %id%
if class in DV2ControlHost,#32769
   return
else
  {
   num:=num+1
   if (Title == "")
   Title=%class%
   LV_Modify(num,"",num,Title,id)
   WinMinimize, ahk_id %id%
   WinHide, ahk_id %id%
   return
}

Show:
if (num > 0)
{
   lastnum=%num%
   num:=num-1
   LV_GetText(restore,lastnum,3)
   LV_Modify(lastnum,"",lastnum,"","")
   WinRestore, ahk_id %restore%
   WinShow, ahk_id %restore%
}
return

Toggles:
{
   if (show == 0)
{
   WinShow, ahk_id %active_id%
   show=1
}
else
{
   WinHide, ahk_id %active_id%
   show=0
}
   return
}

options:
Gui, 2:+LastFound +ToolWindow ;-Caption
Gui, 2:Add, text,, Hide Window:
Gui, 2:Add, text,, Show Window:
Gui, 2:Add, text,, Toggle Poofer:
Gui, 2:Add,Button, x20 y88 gHelp, Help
Gui, 2:Add,Edit, vHk_Hide ym, %Key_Hide%
Gui, 2:Add,Edit, vHk_Show, %Key_Show%
Gui, 2:Add,Edit, vHk_Toggle, %Key_Toggle%
Gui, 2:Add,Button,gSet, Set
Gui, 2:show,w165 h130, Options
return

Set:
Gui, 2:Submit
if not Hk_Hide = ""
{
  Hotkey, %Key_Hide%, Hide, off
  Key_Hide=%Hk_Hide%
  Hotkey, %Key_Hide%, Hide, on,UseErrorLevel
  if ErrorLevel in 5,6
  {
    IniRead,Key_Hide,%A_Desktop%\Poofer.ini,Hotkeys,Hide
    msgbox, Invalid key, Returning to saved Hotkey %Key_Hide%
  }
  else
  {
    IniWrite, %Hk_Hide%, %A_Desktop%\Poofer.ini,Hotkeys,Hide
  }
}

if not Hk_Show = ""
{
  Hotkey, %Key_Show%, Show, off
  Key_Show=%Hk_Show%
  Hotkey, %Key_Show%, Show, on
  if ErrorLevel in 5,6
  {
    IniRead,Key_Show,%A_Desktop%\Poofer.ini,Hotkeys,Show
    msgbox, Invalid key, Returning to saved Hotkey %Key_Show%
  }
  else
  {
    IniWrite, %Hk_Show%, %A_Desktop%\Poofer.ini,Hotkeys,Show
  }
}

if not Hk_Toggle = ""
{
  Hotkey, %Key_Toggle%, Toggles, off
  Key_Toggle=%Hk_Toggle%
  Hotkey, %Key_Toggle%, Toggles, on,UseErrorLevel
  if ErrorLevel in 5,6
  {
    IniRead,Key_Toggle,%A_Desktop%\Poofer.ini,Hotkeys,Toggle
    msgbox, Invalid key, Returning to saved Hotkey %Key_Toggle%
  }
  else
  {
    IniWrite, %Hk_Toggle%, %A_Desktop%\Poofer.ini,Hotkeys,Toggle
  }
}
Gui, 2:Destroy
return

Help:
msgbox,Use these following keys for special keys!`nCtrl:^ Alt:! Shift:+ `nLclick:LButton Rclick:Rbutton `nMiddle Button:MButton WinKey:#
return

GetKeys:
IniRead,Key_Hide,%A_Desktop%\Poofer.ini,Hotkeys,Hide
IniRead,Key_Show,%A_Desktop%\Poofer.ini,Hotkeys,Show
IniRead,Key_Toggle,%A_Desktop%\Poofer.ini,Hotkeys,Toggle

Start:
Gui,+LastFound
Gui,Add,ListView,w216 h200 gList NoSortHdr, #|AppName|id
Loop %maxnum%
LV_Add( "", A_Index, "", "" )
LV_ModifyCol(1,"Interger")
LV_ModifyCol(2,130)
LV_ModifyCol(3,60)
Gui,Add,Button,x10 y210 goptions,options
Gui,Show,w236 h235,Poofer!
Hotkey, %Key_Hide%, Hide, on
Hotkey, %Key_Show%, Show, on
Hotkey, %Key_Toggle%,Toggles, On
return

List:
if A_GuiEvent = DoubleClick
{
  LV_GetText(restore,A_EventInfo,3)
  WinRestore, ahk_id %restore%
  WinShow, ahk_id %restore%
  next:=A_EventInfo+1
  LV_GetText(a1,A_EventInfo,1)

  LV_GetText(a2,next,2)

  LV_GetText(a3,next,3)
  LV_Modify(A_EventInfo,"",a1,a2,a3)
  changes:=maxnum-A_EventInfo
  num:=num-1
  Loop %changes%
  {
    currentspot:=num-A_EventInfo-A_Index
    eventnum:=num-currentspot
    currentnum:=eventnum-1
    LV_GetText(a1,currentnum,1)
    LV_GetText(a2,eventnum,2)
    LV_GetText(a3,eventnum,3)
    LV_Modify(currentnum,"",a1,a2,a3)
    ; Debug ; MsgBox, %changes%`n%currentspot%`n%eventnum%`n%currentnum%
  }   
}
return


2GuiClose:
Gui, Destroy
return

GuiClose:
Loop %num%
{
   LV_GetText(restore,A_Index,3)
   WinRestore, ahk_id %restore%
   WinShow, ahk_id %restore%
}
ExitApp


Last edited by Gosugenji on Fri May 30, 2008 10:15 pm; edited 14 times in total
Back to top
View user's profile Send private message
Trikster



Joined: 15 Jul 2007
Posts: 1142
Location: Enterprise, Alabama

PostPosted: Tue May 13, 2008 1:48 am    Post subject: Reply with quote

A tip, you can take off like 10 lines like so:

Code:

#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
#InstallKeybdHook ; Install Keyboard Hook
#UseHook ON ; Turn Hook On
#notrayicon
#Persistent
#SingleInstance FORCE
DetectHiddenText, on
StringCaseSense On
num=0
lastnum=0
Gosub, Start
return

^+Lbutton::
MouseGetPos, , , id, control
WinGetTitle, title, ahk_id %id%
WinGetClass, class, ahk_id %id%
num:=num+1
if (Title == "")
Title=%class%
WinHide, ahk_id %id%
LV_Modify(num,"",num,Title,id)
return

^+Rbutton::
if (num > 0)
{
lastnum=%num%
num:=num-1
LV_GetText(restore,lastnum,3)
LV_Modify(lastnum,"",lastnum,"","")
WinShow, ahk_id %restore%
}
return

Start:
Gui,+LastFound
Gui,Add,ListView,w216 h200 vLV_Sample NoSortHdr, #|AppName|id
Loop 12
   LV_Add( "", A_Index, "", "" ) 
LV_ModifyCol(1,"Interger")
LV_ModifyCol(2,130)
LV_ModifyCol(3,60)
Gui,Show,w236 h210 (0.03)
return

GuiClose:
ExitApp

_________________
Join AutoHotkey's Whatpulse Team today!

~Ian
Back to top
View user's profile Send private message
Gosugenji



Joined: 07 May 2008
Posts: 35
Location: In your Internets

PostPosted: Tue May 13, 2008 1:50 am    Post subject: Reply with quote

haha I didn't think of that, i'll note that change Laughing
Back to top
View user's profile Send private message
Guest






PostPosted: Tue May 13, 2008 4:17 am    Post subject: Reply with quote

You can also take out these 3 lines
Code:
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
#InstallKeybdHook ; Install Keyboard Hook
#UseHook ON ; Turn Hook On
#Persistent


Reasons:
- 1st line: You never use the "Send" command
- 2nd line: Keyboard hook is automatically installed whenever a hotkey that requires it is present in the script (most hotkeys don't)
- 3rd line: Keyboard hook is automatically used for hotkeys that need it
- 4th line: Scripts with a "Gui" command in them are automatically persistent

Very nice little script on the whole Very Happy
Back to top
Gosugenji



Joined: 07 May 2008
Posts: 35
Location: In your Internets

PostPosted: Tue May 13, 2008 4:59 am    Post subject: Reply with quote

Thanks, Im currently working on the double click restore feature, and a couple other things at that. The reason behind the useless beginning code is that i use a base code for all my scripts and just add on to it. Just lazy to remove it i guess. But look for the new features in the coming days Smile
Back to top
View user's profile Send private message
Gosugenji



Joined: 07 May 2008
Posts: 35
Location: In your Internets

PostPosted: Tue May 13, 2008 9:21 pm    Post subject: New Release! V.05 Reply with quote

Bunch of new features, and i think this program is done. any suggestions are welcome Smile
Back to top
View user's profile Send private message
Guest






PostPosted: Wed May 14, 2008 12:06 am    Post subject: Re: New Release! V.05 Reply with quote

Gosugenji wrote:
Bunch of new features, and i think this program is done. any suggestions are welcome Smile
screenshot?
Back to top
Gosugenji



Joined: 07 May 2008
Posts: 35
Location: In your Internets

PostPosted: Wed May 14, 2008 12:43 am    Post subject: Heres a screenie of the app Reply with quote

Screenshot of the app.
Back to top
View user's profile Send private message
Razlin



Joined: 05 Nov 2007
Posts: 288
Location: canada

PostPosted: Thu May 15, 2008 7:57 pm    Post subject: Reply with quote

Nice app..
I wrote something very very very similar about a month ago.

it has the ability to double click to restore windows and also saves hidden windows to a text file << wanted to add future options but never did.

anyhow here.s mine if you want to look at the double click idea.

WIN+H to hide window
win+S to Show hidden window.

I use it to remove the clutter of IE windows I have open often.
also use it to hide "File copy" windows so I dont accidentally cancel them but hitting space bar.

Feel free to take what you need from it.

Code:
#h::
      winget, hwin, id, A
      wingettitle, wintitle, ahk_id %hwin%
      iniWrite, %wintitle%, c:\hidden.ahk.ini, hidden, %hwin%
      winhide, ahk_id %hwin%
return

10GUIESCAPE:
gui, 10:destroy
return

#S::
WinS_reset:
gui, 10:destroy
GUI, 10: +Toolwindow
Gui, 10:Add, ListView, AltSubmit x0 y0 w500 h200 vWinList gWinList, Key|Window Title
Gui, 10:Add, Button, x0 y200 w200 h30 gShowWindow, Show Window
Gui, 10:Add, Button, x200 y200 w100 h30 gShowWindowExplorer, Show ALL IExplorer
Gui, 10:Add, Button, x300 y200 w100 h30 gcloseGUI_10, Cancel
Gui, 10:Add, Button, x400 y200 w100 h30 gclearHiddenWindowFile, Clear File
Gui, 10:Show, x198 y259 h230 w500, Show Window
Gui, 10:Default


skipfirstline = 1
Loop, read, c:\hidden.ahk.ini
{
   ; make sure its not the [hidden] field
   if skipfirstline = 1
   {
      skipfirstline = 0
   }
   else
   {
      StringGetPos, split_loc, A_LoopReadLine, =
      StringLeft, hwinval, A_LoopReadLine, split_loc
      Stringmid, hwintitle, A_LoopReadLine, split_loc+2
      LV_Add("",hwinval,hwintitle)
   }
}
LV_ModifyCol()
LV_ModifyCol(1, 0)
GuiControl, 10: +Redraw, winList
return

closeGUI_10:
gui, 10:destroy
return

WinList:
if A_GuiEvent = Normal
{
   LV_GetText( Target, A_EventInfo, 1)
}
if A_GuiEvent = doubleClick
{
   gosub showwindow2click
}
return

showwindow2click:
   LV_GetText( Target, A_EventInfo, 1)
showWindow:
   winshow, ahk_id %target%
   IniDelete, c:\hidden.ahk.ini, hidden, %Target%
   LV_DELETE(A_EventInfo)
   gui, 10:destroy
Return

ShowWindowExplorer:
   GroupAdd, G_showexplorerWindows, ahk_class IEFrame
   winshow, ahk_group G_showexplorerWindows
return

clearHiddenWindowFile:
      FileDelete c:\hidden.ahk.ini
   goto WinS_reset
return

_________________
-=Raz=-
Back to top
View user's profile Send private message
Gosugenji



Joined: 07 May 2008
Posts: 35
Location: In your Internets

PostPosted: Sun May 25, 2008 9:40 pm    Post subject: New Release! V.05a Reply with quote

New Release! V.5a
Read changelog above
Back to top
View user's profile Send private message
joebodo



Joined: 28 Apr 2008
Posts: 27

PostPosted: Mon May 26, 2008 12:27 am    Post subject: Reply with quote

I created a plugin containing your functionality for my Redstone application launcher.

Here's the code:

http://www.autohotkey.net/~joebodo/poofer-plugin.zip
Back to top
View user's profile Send private message
Gosugenji



Joined: 07 May 2008
Posts: 35
Location: In your Internets

PostPosted: Mon May 26, 2008 1:11 am    Post subject: Reply with quote

Thats awesome. It's great to see my work being put to use Very Happy
Back to top
View user's profile Send private message
Rumolly
Guest





PostPosted: Wed May 28, 2008 12:57 am    Post subject: Reply with quote

well too bad luis...
Back to top
Gosugenji



Joined: 07 May 2008
Posts: 35
Location: In your Internets

PostPosted: Fri May 30, 2008 1:37 am    Post subject: New Release! V1.0!!!!oneone111 Reply with quote

Added customization via ini file, and ability to load ini on script launch.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   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