-
Notifications
You must be signed in to change notification settings - Fork 0
/
pwEnterServiceRemove.ahk
80 lines (64 loc) · 2.04 KB
/
pwEnterServiceRemove.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
67
68
69
70
71
72
73
74
; pwEnterServiceRemove.ahk
; Helper app to remove "pwEnterService" from memory!
#Requires Autohotkey v2+
#SingleInstance Force
#Warn
; "pwEnterService.exe" closes itself if it detects a running app named "pwEnterServiceRemove.exe"
currentRunningApps := getRunningAppsAsString()
if (InStr(currentRunningApps, "pwEnterService.exe")){
showHintColoredPosY("Closing of service `" pwEnterService `" requested!")
Loop 6 {
currentRunningApps := getRunningAppsAsString()
if (!InStr(currentRunningApps, "pwEnterService.exe"))
break
sleep 1000
}
if (InStr(currentRunningApps, "pwEnterService.exe")){
showHintColoredPosY("ERROR, `"pwEnterService`" does not react on the closing request!",,,,0)
} else {
showHintColoredPosY("Ok, `"pwEnterService`" removed from memory!",,,,0)
}
} else {
showHintColoredPosY("`"pwEnterService`" is not running!",,,,0)
exitApp
}
exitApp
;-------------------------- getRunningAppsAsString --------------------------
getRunningAppsAsString(){
DetectHiddenWindows true
runningApps := ""
runningAppsList := WinGetList(,, "Program Manager")
if (runningAppsList.Length > 0){
for key, idNumber in runningAppsList {
try {
idTitle := WinGetTitle(idNumber)
runningApps .= idTitle . " | "
}
}
}
return runningApps
}
;-------------------------- showHintColoredPosY --------------------------
showHintColoredPosY(s := "", n := 3000, fg := "cEE0000", bg := "FFFFFF", yPos := 80){
global
local t
if (IsSet(hintColored))
destroyHintColored()
hintColored := Gui("+0x80000000 -Caption +Border +ToolWindow +AlwaysOnTop")
hintColored.SetFont("c" fg)
hintColored.BackColor := bg
hintColored.add("Text", , s)
hintColored.Show("y" yPos " xcenter")
if (n > 0){
sleep n
destroyHintColored()
} else {
settimer destroyHintColored, n
}
}
;---------------------------- destroyHintColored ----------------------------
destroyHintColored(*){
global
hintColored.Destroy()
}
;----------------------------------------------------------------------------