You didn't specify they needed google in the title so it found all of them.
EDIT: ahh I see now you did want to close ALL windows. I'll check that one second
EDIT: You've got to make sure first off you're not trying to kill windows with no title
Code: Select all
#SingleInstance, force
^z::
WinGet, OutputVar, List
msgbox, %outputvar% windows found!
loop, % outputvar
{
outID := outputvar%A_Index%
WinGetTitle, outTitle, ahk_id %outID%
If (outTitle != "")
{
if winexist("ahk_id" . outID)
winkill
}
}
return
But then... if you take a look at my list of window titles (after ignoring the blank ones) there is a window called "Start" and one called "Program Manager"
I would check yours as well and then blacklist those 2 from the kill command if you get the same results
If ((outTitle != "") && (outTitle != "Start") && (outTitle != "Program Manager"))
Moving onto your google stuff the 4th paramter of WinGet is an optional title name which has to be somewhere in the title
WinGet, OutputVar, List, Google
However tabs are not windows though...You can't close different tabs like you can different windows.
If that's what you are trying to do then...
Pressing Ctrl+Shift+Tab goes backwards through all your open tabs and Ctrl+Tab goes forwards 1 at a time
Pressing Ctrl+W closes the current tab