-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCloseAllDemos.ahk
66 lines (55 loc) · 1.73 KB
/
CloseAllDemos.ahk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
; Stops all running demos
; Exclusion examples:
GroupAdd, DemoWindowsExclude, ahk_class SideBar_AppBarWindow
; These two come in pairs for the Vista sidebar gadgets:
GroupAdd, DemoWindowsExclude, ahk_class SideBar_HTMLHostWindow ; gadget content
GroupAdd, DemoWindowsExclude, ahk_class BasicWindow ; gadget shadow/outline
GroupAdd, DemoWindowsExclude, LockUP_cover ; gadget shadow/outline
; Comma-delimited list of processes to exclude.
; We exclude ALL windows belonging to these processes
DemoProcessesExcludeList = chrome.exe,explorer.exe,Dwm.exe,WerFault.exe,notepad++.exe,taskmgr.exe,mstsc.exe
; List all visible windows.
WinGet, win, List
FileAppend,
(
Closing demos...
), CloseAllDemos.log
Loop, %win%
{
; If this window matches the DemoWindowsExclude group, don't touch it.
if (WinExist("ahk_group DemoWindowsExclude ahk_id " . win%A_Index%))
continue
; Set Last Found Window.
if (!WinExist("ahk_id " . win%A_Index%))
continue
WinGet, procname, ProcessName
; Check process (program) exclusion list.
if procname in %DemoProcessesExcludeList%
continue
windowName := win%A_Index%
FileAppend,
(
Closing window from process %procname% %windowName%
), CloseAllDemos.log
if (procname == "CCV.exe")
{
; WinActivate, ahk_id %windowName%
; Send {Esc}
WinClose, ahk_id %windowName%
WinWaitClose, ahk_id %windowName%
}
else if (procname == "javaw.exe")
{
; full screen (present mode) Processing applications don't exit as expected from WinClose, so use Esc key instead/in addition
WinClose, ahk_id %windowName%
IfWinExist, ahk_id %windowName%"
{
WinActivate
Send {Esc}
}
}
else
{
WinClose, ahk_id %windowName%
}
}