-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprocs.ahk
43 lines (38 loc) · 1.05 KB
/
procs.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
#Requires AutoHotkey v2.0
^!Up:: {
procs := ["turtl.exe", "DiscordCanary.exe", "firefox.exe",
"Routine.exe", "Spotify.exe", "Telegram.exe", "KeePass.exe",
"Antidote.exe", "slack.exe", "Spike.exe"]
DoProcs(*) {
Input := MyInput.Text
if (Input = "close") {
CloseProcs()
OpenCloseGui.Hide
} else if (Input = "open") {
RunProcs()
OpenCloseGui.Hide
} else {
MsgBox("Invalid input. Need 'open' or 'close'")
}
return
}
CloseProcs(*) {
for p in procs
if (PID := ProcessExist(p)) {
ProcessClose(PID)
}
return
}
RunProcs(*) {
for p in procs
if (!PID := ProcessExist(p)) {
Run "shell:startup" p
}
return
}
OpenCloseGui := Gui('+ToolWindow', 'Open/Close')
MyInput := OpenCloseGui.AddEdit("vInputField")
MyBtn := OpenCloseGui.AddButton("Default w80", "OK")
MyBtn.OnEvent("Click", DoProcs)
OpenCloseGui.Show
}