help!

Get help with using AutoHotkey and its commands and hotkeys
awcrt9316
Posts: 61
Joined: 03 Mar 2020, 20:06

help!

28 Apr 2020, 21:36

Why does a shutdown option appear with my script? I am trying to close all current windows. Also, is it possible for me to close a window by title if it isn't the active window?
I looked at the documentation and these things below under winclose don't seen to correspond to the name of the website, such as https://google.com. I would like to close all google.com's for example.

ahk_class
ahk_id
ahk_pid
ahk_exe
ahk_group

Code: Select all

#SingleInstance, force
^z::
WinGet, OutputVar, List
msgbox, % outputvar
a := 1
loop, % outputvar
{
if winexist("ahk_id" . outputvar%a%)
winkill
a++
}


looking through documentation more, I found this: SetTitleMatchMode RegEx

not sure how to use it though
Rohwedder
Posts: 3655
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: help!

29 Apr 2020, 03:31

Hallo,
if you close all windows you also close Windows.
Try:

Code: Select all

q::winkill, ahk_class Progman
w::winkill, ahk_class Shell_TrayWnd
If you close only one of these two windows, you close Windows.

This should keep Windows alive:

Code: Select all

#SingleInstance, force
^z::
WinGet, OutputVar, List
msgbox, % outputvar
a := 1
loop, % outputvar
{
	WinGetClass, Class,% "ahk_id" . outputvar%a%
	IF Class not contains Progman,Shell_TrayWnd,Shell_SecondaryTrayWnd
		winkill,% "ahk_id" . outputvar%a%
	a++
}
(instead of the variable a you can also simply use A_Index)

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], hugin, mikeyww, Previz, TAC109 and 55 guests