How to close all the windows of chrome by a hotkey ? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
hancre
Posts: 241
Joined: 02 Jul 2021, 20:51

How to close all the windows of chrome by a hotkey ?

Post by hancre » 17 Sep 2021, 19:28

I use this following code. But it close a chrome window per a hotkey press.
I want to close all chrome window by a hotkey press.

Code: Select all

WinGet, chromeWindows, List, ahk_exe chrome.exe
Loop % chromeWindows
   WinClose, % "ahk_id" chromeWindows%A_Index%
and it shows the attached image after I press the hotkey to close all the windows 2~3 times.

How can i fix the issue and prevent the popup?
Thanks for any help in advance.
Attachments
temp_0918_001.jpg
temp_0918_001.jpg (56.12 KiB) Viewed 1044 times
User avatar
mikeyww
Posts: 26437
Joined: 09 Sep 2014, 18:38

Re: How to close all the windows of chrome by a hotkey ?

Post by mikeyww » 17 Sep 2021, 20:12

Show your script.
hancre
Posts: 241
Joined: 02 Jul 2021, 20:51

Re: How to close all the windows of chrome by a hotkey ?

Post by hancre » 17 Sep 2021, 21:25

mikeyww wrote:
17 Sep 2021, 20:12
I use this script with my other scripts. It's so long.
sorry to bother you. @.@
mostly the pop-up doesn't show.
but I should press the hotkey again for the 2nd and 3rd chrome window.
I want to close all the chrome windows at once ?
and I don't like soundbeep. ^^
Last edited by hancre on 19 Sep 2021, 02:46, edited 2 times in total.
User avatar
mikeyww
Posts: 26437
Joined: 09 Sep 2014, 18:38

Re: How to close all the windows of chrome by a hotkey ?  Topic is solved

Post by mikeyww » 17 Sep 2021, 21:37

I am assuming that this is your entire script, and you have no other scripts running. I used the following and never saw a popup.

Code: Select all

!+F4::
SoundBeep, 1500
WinGet, chromeWindows, List, ahk_exe chrome.exe
Loop, % chromeWindows
 WinClose, % "ahk_id " chromeWindows%A_Index%
Return
hancre
Posts: 241
Joined: 02 Jul 2021, 20:51

Re: How to close all the windows of chrome by a hotkey ?

Post by hancre » 19 Sep 2021, 02:48

mikeyww wrote:
17 Sep 2021, 21:37
Thanks for your code.
It works. today the pop-up never shows.
I expect my system cause the pop-up, not AutoHotkey scripts.
Post Reply

Return to “Ask for Help (v1)”