I have created a script to auto-arrange the windows of specific programs when they are active. The script works fine but I encountered a problem, when the windows title of my two browsers (Chrome/Firefox) have the same title (ie when I open the Steam store) they are auto-arranged as well. How can I avoid this?
I know I can use the ahk_exe parameter to distinguish the windows better, but I was wondering if there is a simpler,more generic way to accomplish this.
I tried the #IfWinNotActive ahk_class MozillaWindowClass parameter at the start of my script but with no result, the browsers still auto-arrange. here is my code:
Code: Select all
#Persistent
Settitlematchmode 2
SetTimer, check, 500
return
check:
GroupAdd, maximum, Google Chrome
GroupAdd, maximum, Task Manager
GroupAdd, maximum, ahk_exe uTorrent.exe
GroupAdd, maximum, JDownloader
GroupAdd, central, Steam
GroupAdd, central, Battle.net
GroupAdd, central, Origin
GroupAdd, central, Uplay
GroupAdd, central, Internet Download Manager
GroupAdd, central, Last.fm
GroupAdd, central, Skype
IfWinActive, ahk_group maximum
gosub, automax
IfWinActive, ahk_group central
gosub, autocenter
return
automax:
WinGetActiveTitle, title
WinGet, maximized, MinMax, %title%
if (maximized) = 0
WinMaximize, %title%
return
autocenter:
WinGetActiveTitle, title
WinGetPos,,, Width, Height, %title%
WinMove, %title%,, (A_ScreenWidth/2)-(Width/2), (A_ScreenHeight/2)-(Height/2)