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 

!Panic

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



Joined: 19 Mar 2007
Posts: 463

PostPosted: Thu Jun 26, 2008 11:05 pm    Post subject: !Panic Reply with quote

Ok, so i picked up one of my old scripts (Panic for IE, hides all IE windows) and decided to make an upgrade. Now it hides whatever you add to presets either by class or by title. You can add items by right clicking scripts tray icon
and selecting appropriate option. Keep in mind that config is created in the same directory.

How to:
Middle click - hide all
ctrl + space: open GUI (you reveal windows from it).

Tooltips and message boxes will guide you through the rest.
Code:
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#Persistent
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
#SingleInstance Force
SetBatchLines -1


;----------------------------------------------------------------
;build menu
;----------------------------------------------------------------
Menu tray, NoStandard
Menu tray, add
Menu tray, add, Add by Title, by_Title
Menu tray, add, Add by Class, by_Class
Menu tray, add

Menu tray, add, Quit, Exit

;----------------------------------------------------------------
;build GUI
;----------------------------------------------------------------
Gui Add, ListView, x-4 y0 w210 h320 gSelected, Links
Gui Add, Button, x0 y321 w157 h30, Restore All
Gui Add, Button, x156 y321 w50 h30, Clear
Gui +AlwaysOnTop
return

;----------------------------------------------------------------
;hide windows
;----------------------------------------------------------------
MButton::
IfNotExist config.txt
   {
   MsgBox You have to specify which windows to hide, before you can proceed.`nRight click Panics tray icon to do that.
   return
}
;create group of windows to hide
loop read, config.txt
   GroupAdd hideGroup, %A_LoopReadLine%
 
; GroupAdd hideGroup, ahk_class IEFrame
; GroupAdd hideGroup, ahk_class MozillaUIWindowClass
WinGet IDarray, list, ahk_group hideGroup

Loop %IDarray%   {
   ;get current window ID
   ID := IDarray%A_Index%

   ;get title
   WinGetTitle address, ahk_id %ID%
   
   ;add to list view
   LV_Add("", address)
   FullList .= address . "`n"
}
;hide all
WinHide ahk_group hideGroup
return

;----------------------------------------------------------------
;toggle GUI
;----------------------------------------------------------------
~^space::
IfWinNotExist !Panic
   Gui Show, x293 y125 h352 w206, !Panic
else
   WinHide !Panic
Return

GuiClose:
Gui Hide
return

;----------------------------------------------------------------
;restore all hidden windows
;----------------------------------------------------------------
ButtonRestoreAll:
LV_Delete()
FullList =
WinShow ahk_group hideGroup
WinHide !Panic
return

;----------------------------------------------------------------
;restore by title on double click
;----------------------------------------------------------------
Selected:
Gui Submit, NoHide
if (A_GuiEvent = "DoubleClick") {
   LV_GetText(toBeRestored, A_EventInfo)
   WinShow %toBeRestored%
   
   StringReplace FullList, FullList, %toBeRestored%`n
   LV_Delete()

   ;reload list content
   loop parse, FullList, `n
      LV_Add("", A_LoopField)
}
return

;----------------------------------------------------------------
;clear all
;----------------------------------------------------------------
ButtonClear:
LV_Delete()
FullList =
WinHide !Panic
return

;----------------------------------------------------------------
by_Title:
   TrayTip Add Item by Title, Activate window that you would like to add.`n Press Enter when done., 10, 1
   KeyWait enter, D
   TrayTip
   WinGetTitle addMe, A
   
   fileRead file, config.txt
   if !InStr(file, addMe . "`r`n")
      FileAppend %addMe%`n, config.txt
      
return
;----------------------------------------------------------------
by_Class:
   TrayTip Add Item by Class, Activate window that you would like to add.`n Press Enter when done., 10, 1
   KeyWait enter, D
   TrayTip
   WinGetClass addMe, A
   
   fileRead file, config.txt
   if !InStr(file, "ahk_class " . addMe . "`r`n")
      FileAppend ahk_class %addMe%`n, config.txt

return

;----------------------------------------------------------------
;Quit
;----------------------------------------------------------------
Exit:
ExitApp


P.S. It's not only for IE anymore, that's why i created new topic.
_________________
simplified csv - easy way to handle csv files.
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