 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Unambiguous
Joined: 18 May 2005 Posts: 4
|
Posted: Sat Apr 22, 2006 5:56 pm Post subject: Minimize Inactive Windows |
|
|
Well, I realize after the post yesterday that noone was really interested in the idea, so I gave it a try myself.
This script will minimize any inactive windows after n seconds. The reason for this is that I have a lot of windows open normally, and just forget they are there. This allows for a much cleaner workspace.
Its working OK for me now and with the time settings currently in place, it takes about 1 minute for an app to become minimized when in the background.
Change the filter section to match your apps.
| Code: |
#Persistent
DetectHiddenWindows, Off
SetTimer, CheckIfActive, 1000
return
CheckIfActive:
WinGet, id, list, , , Program Manager
Loop, %id%
{
StringTrimRight, this_id, id%a_index%, 0
WinGetTitle, title, ahk_id %this_id%
WinGet, id_min, ID, ahk_id %this_id%
WinGet, minim , MinMax, ahk_id %this_id%
;blank
If title =
continue
;filter
If (title = "Desktop Coral" or title = "Serence Klipfolio")
continue
; if minimized, restart on new app
If minim = -1
continue
; if active task, reset counter to 0
IfWinActive, ahk_id %id_min%
{
wininactive%ID_min% = 0
continue
}
; if counter is less than 60, add 1 or minimize and reset
If wininactive%ID_min% < 60
{
If wininactive%ID_min% =
wininactive%ID_min% = 0
wininactive%ID_min% += 1
}
Else
{
WinMinimize, ahk_id %id_min%
wininactive%ID_min% = 0
}
}
return |
|
|
| Back to top |
|
 |
robiandi Guest
|
Posted: Sun Apr 23, 2006 9:10 am Post subject: |
|
|
Thanks for the nice idea.
If you are using the editor PSPad you have to add the following lines
| Code: |
winget processname,processname, ahk_id %this_id%
WinGetClass class , ahk_id %this_id%
if ( processname = "PSPad.exe" and class = "TApplication" )
continue
| because there is still another relevant class: TfPSPad
Without these lines the Editor will be minimized although you are just typing in it. |
|
| Back to top |
|
 |
robiandi Guest
|
Posted: Sun Apr 23, 2006 9:29 am Post subject: |
|
|
For the sake of simplicity I will write down the whole script
| Code: |
; script of Unambiguous adjusted for use with PSPad
#Persistent
SetTimer, CheckIfActive, 1000
return
CheckIfActive:
WinGet, id, list, , , Program Manager
Loop, %id%
{
StringTrimRight, this_id, id%a_index%, 0
WinGetTitle, title, ahk_id %this_id%
WinGet, id_min, ID, ahk_id %this_id%
WinGet, minim , MinMax, ahk_id %this_id%
winget processname,processname, ahk_id %this_id%
WinGetClass class , ahk_id %this_id%
if ( processname = "PSPad.exe" and class = "TApplication" )
continue
If title =
continue
If minim = -1 ; alread minimized
continue
; if active task, reset counter to 0
IfWinActive, ahk_id %id_min%
continue
; if counter is less than 60, add 1 or minimize and reset
If wininactive%ID_min% < 60
wininactive%ID_min% += 1
Else
{
WinMinimize, ahk_id %id_min%
wininactive%ID_min% = 0
}
}
return
|
|
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|