Closing 5 programs with 1 keyboard shortcut

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
empardopo
Posts: 336
Joined: 06 Oct 2013, 12:50
Location: Spain
Contact:

Re: Closing 5 programs with 1 keyboard shortcut

20 Feb 2015, 02:48

enthused wrote:would this work:

Code: Select all

SetTitleMatchMode, RegEx

; Create the group only once, with each app window on a separate line.
GroupAdd MultiClose, ahk_exe Notepad.exe
GroupAdd MultiClose, ahk_exe SciTE.exe
GroupAdd MultiClose, ahk_exe thunderbird(.*)

!q::
WinClose, ahk_group MultiClose  ; No comma between ahk_group and MultiClose.
; Note this closes the windows; it does not kill processes, so some apps
; might continue to run in the backgroud.
Return

Esc::ExitApp

I have two processes running called AllInOneFYC.exe and AllInOneFYC1055.exe. Is possible to kill them using a group? (AllInOneFYC(.*) or similar)
Thanks
Everything is possible!
DutchPete

Re: Closing 5 programs with 1 keyboard shortcut

20 Feb 2015, 06:11

I thought I posted earlier on today but don't see my post.
Anyway, following Enthused's post yesterday, I ran his script, and that did close T/bird, though not the other programs which I had added to the script. So, his thunderbird(.*) is the way forward rather than Mozilla.
I then added thunderbird(.*) to Lexikos's script, but that again failed to close T/bird.
Conclusion: Empardopo's last script from yesterday is the one that works fully for me, even though from a scripting point of view it is not optimal for T/bird & Firefox (= Pale Moon in my case).
enthused
Posts: 94
Joined: 27 Dec 2014, 03:28

Re: Closing 5 programs with 1 keyboard shortcut

20 Feb 2015, 08:35

empardopo wrote: I have two processes running called AllInOneFYC.exe and AllInOneFYC1055.exe. Is possible to kill them using a group? (AllInOneFYC(.*) or similar)
Thanks
I think it should work. Let me know if it works.
enthused
Posts: 94
Joined: 27 Dec 2014, 03:28

Re: Closing 5 programs with 1 keyboard shortcut

20 Feb 2015, 08:38

DutchPete wrote:I then added thunderbird(.*) to Lexikos's script, but that again failed to close T/bird.
Did you add this line to the top of the script:
SetTitleMatchMode, RegEx

Try this script:

Code: Select all

SetTitleMatchMode, RegEx

; Create the group only once, with each app window on a separate line.
GroupAdd MultiClose, ahk_exe Notepad(.*)
GroupAdd MultiClose, ahk_exe SciTE(.*)
GroupAdd MultiClose, ahk_exe thunderbird(.*)

!q::
WinClose, ahk_group MultiClose  ; No comma between ahk_group and MultiClose.
; Note this closes the windows; it does not kill processes, so some apps
; might continue to run in the backgroud.
Return

Esc::ExitApp
DutchPete

Re: Closing 5 programs with 1 keyboard shortcut

20 Feb 2015, 08:51

@ enthused: I copied your script, only replaced the names of notepad & scite with names of programs I use. All have (.*) behind their name. But ..... only T/bird & Pale Moon are closed.
enthused
Posts: 94
Joined: 27 Dec 2014, 03:28

Re: Closing 5 programs with 1 keyboard shortcut

20 Feb 2015, 08:53

DutchPete wrote:@ enthused: I copied your script, only replaced the names of notepad & scite with names of programs I use. All have (.*) behind their name. But ..... only T/bird & Pale Moon are closed.
Can you post your script?
Likely something minor needs to be changed.
DutchPete

Re: Closing 5 programs with 1 keyboard shortcut

20 Feb 2015, 09:01

Here it is:

SetTitleMatchMode, RegEx

; Create the group only once, with each app window on a separate line.
GroupAdd MultiClose, ahk_exe evernote(.*)
GroupAdd MultiClose, ahk_exe onenote(.*)
GroupAdd MultiClose, ahk_exe palemoon(.*)
GroupAdd MultiClose, ahk_exe thunderbird(.*)

!q::
WinClose, ahk_group MultiClose ; No comma between ahk_group and MultiClose.
; Note this closes the windows; it does not kill processes, so some apps
; might continue to run in the backgroud.
Return

Esc::ExitApp
User avatar
empardopo
Posts: 336
Joined: 06 Oct 2013, 12:50
Location: Spain
Contact:

Re: Closing 5 programs with 1 keyboard shortcut

20 Feb 2015, 09:08

enthused wrote:
empardopo wrote: I have two processes running called AllInOneFYC.exe and AllInOneFYC1055.exe. Is possible to kill them using a group? (AllInOneFYC(.*) or similar)
Thanks
I think it should work. Let me know if it works.
It does not work.
Thanks

Note: My processes do not have Gui.
Everything is possible!
enthused
Posts: 94
Joined: 27 Dec 2014, 03:28

Re: Closing 5 programs with 1 keyboard shortcut

20 Feb 2015, 09:25

I don't have Evernote on my computer so can't test it but one note closes fine (2010 version)
Make sure you copy the AHK_exe name exactly as you see in winspy

Code: Select all

SetTitleMatchMode, RegEx

; Create the group only once, with each app window on a separate line.
GroupAdd MultiClose, ahk_exe evernote(.*)
GroupAdd MultiClose, ahk_exe ONENOTE(.*)
GroupAdd MultiClose, ahk_exe palemoon(.*)
GroupAdd MultiClose, ahk_exe thunderbird(.*)

!q::
WinClose, ahk_group MultiClose ; No comma between ahk_group and MultiClose.
; Note this closes the windows; it does not kill processes, so some apps
; might continue to run in the backgroud.
Return

Esc::ExitApp
DutchPete

Re: Closing 5 programs with 1 keyboard shortcut

20 Feb 2015, 09:39

Yes Enthused, that works fine. I just had to change evernote to Evernote.
Thanks a lot :D
enthused
Posts: 94
Joined: 27 Dec 2014, 03:28

Re: Closing 5 programs with 1 keyboard shortcut

20 Feb 2015, 10:27

empardopo wrote:
enthused wrote:
empardopo wrote: I have two processes running called AllInOneFYC.exe and AllInOneFYC1055.exe. Is possible to kill them using a group? (AllInOneFYC(.*) or similar)
Thanks
I think it should work. Let me know if it works.
It does not work.
Thanks

Note: My processes do not have Gui.
I noticed thunderbird doesn't close if the window is hidden. This maybe the problem if there is no gui?
How do you close the process normally?
MJs
Posts: 454
Joined: 23 Sep 2014, 03:29

Re: Closing 5 programs with 1 keyboard shortcut

20 Feb 2015, 10:53

DutchPete wrote:I just had to change evernote to Evernote.
the problem is since you're using SetTitleMatchMode, RegEx, RegEx is case sensitive by default
So, just for sports, add i) to the ahk_exes:
example:

Code: Select all

SetTitleMatchMode, RegEx

; Create the group only once, with each app window on a separate line.
GroupAdd MultiClose, ahk_exe i)(evernote|onenote|palemoon|thunderbird)(.*)

!q::
WinClose, ahk_group MultiClose ; No comma between ahk_group and MultiClose.
; Note this closes the windows; it does not kill processes, so some apps
; might continue to run in the backgroud.
Return

Esc::ExitApp
DutchPete

Re: Closing 5 programs with 1 keyboard shortcut

20 Feb 2015, 11:40

Wow MJs, this is really cool. It works. Thank you too.
Thank you to all those who contributed, it is truly impressive !!
enthused
Posts: 94
Joined: 27 Dec 2014, 03:28

Re: Closing 5 programs with 1 keyboard shortcut

20 Feb 2015, 21:18

MJs that was nice :D

here is ultimately the script (4 lines) :D

Code: Select all

SetTitleMatchMode, RegEx

GroupAdd MultiClose, ahk_exe i)(evernote|onenote|palemoon|thunderbird)(.*)

!q::WinClose, ahk_group MultiClose ; No comma between ahk_group and MultiClose.

Esc::ExitApp
DutchPete

Re: Closing 5 programs with 1 keyboard shortcut

21 Feb 2015, 05:05

There is still 1 more step ;) : leave off No comma between ahk_group and MultiClose.

SetTitleMatchMode, RegEx

GroupAdd MultiClose, ahk_exe i)(evernote|onenote|palemoon|thunderbird)(.*)

!q::WinClose, ahk_group MultiClose

Esc::ExitApp
enthused
Posts: 94
Joined: 27 Dec 2014, 03:28

Re: Closing 5 programs with 1 keyboard shortcut

21 Feb 2015, 13:04

DutchPete wrote:There is still 1 more step ;) : leave off No comma between ahk_group and MultiClose.

SetTitleMatchMode, RegEx

GroupAdd MultiClose, ahk_exe i)(evernote|onenote|palemoon|thunderbird)(.*)

!q::WinClose, ahk_group MultiClose

Esc::ExitApp
That was a relevant comment :P

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: CaseyMoon, imstupidpleshelp, JoeWinograd, mmflume, Rohwedder and 173 guests