Page 2 of 2

Re: Closing 5 programs with 1 keyboard shortcut

Posted: 20 Feb 2015, 02:48
by empardopo
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

Re: Closing 5 programs with 1 keyboard shortcut

Posted: 20 Feb 2015, 06:11
by DutchPete
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).

Re: Closing 5 programs with 1 keyboard shortcut

Posted: 20 Feb 2015, 08:35
by enthused
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.

Re: Closing 5 programs with 1 keyboard shortcut

Posted: 20 Feb 2015, 08:38
by enthused
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

Re: Closing 5 programs with 1 keyboard shortcut

Posted: 20 Feb 2015, 08:51
by DutchPete
@ 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.

Re: Closing 5 programs with 1 keyboard shortcut

Posted: 20 Feb 2015, 08:53
by enthused
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.

Re: Closing 5 programs with 1 keyboard shortcut  Topic is solved

Posted: 20 Feb 2015, 09:01
by DutchPete
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

Re: Closing 5 programs with 1 keyboard shortcut

Posted: 20 Feb 2015, 09:08
by empardopo
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.

Re: Closing 5 programs with 1 keyboard shortcut

Posted: 20 Feb 2015, 09:25
by enthused
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

Re: Closing 5 programs with 1 keyboard shortcut

Posted: 20 Feb 2015, 09:39
by DutchPete
Yes Enthused, that works fine. I just had to change evernote to Evernote.
Thanks a lot :D

Re: Closing 5 programs with 1 keyboard shortcut

Posted: 20 Feb 2015, 10:27
by enthused
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?

Re: Closing 5 programs with 1 keyboard shortcut

Posted: 20 Feb 2015, 10:53
by MJs
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

Re: Closing 5 programs with 1 keyboard shortcut

Posted: 20 Feb 2015, 11:40
by DutchPete
Wow MJs, this is really cool. It works. Thank you too.
Thank you to all those who contributed, it is truly impressive !!

Re: Closing 5 programs with 1 keyboard shortcut

Posted: 20 Feb 2015, 21:18
by enthused
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

Re: Closing 5 programs with 1 keyboard shortcut

Posted: 21 Feb 2015, 05:05
by DutchPete
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

Re: Closing 5 programs with 1 keyboard shortcut

Posted: 21 Feb 2015, 13:04
by enthused
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