-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdbdhook2023-1440.ahk
87 lines (72 loc) · 1.95 KB
/
dbdhook2023-1440.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
75
76
77
78
79
80
81
82
83
84
85
86
87
#Persistent
#SingleInstance Force
#NoEnv
FolderPath := "C:\temp"
IfNotExist, %FolderPath%
{
FileCreateDir, %FolderPath%
}
FileDelete, C:\temp\hook.ini
Loop, 4 {
IniWrite, 0, C:\temp\hook.ini, %A_Index%, %A_Index%
}
; Retrieve primary monitor's screen resolution
SysGet, ScreenWidth, 0 ; Retrieves the width of the primary monitor
SysGet, ScreenHeight, 1 ; Retrieves the height of the primary monitor
; Calculate X and Y position for the GUI based on the screen resolution
; Adjust these fractions to change the position relative to your screen
GuiX := ScreenWidth * 0.005 ; Example: 13% of screen width
GuiY := ScreenHeight * 0.42 ; Example: 42% of screen height
CustomColor = EEAA99
Gui +LastFound +AlwaysOnTop -Caption +ToolWindow
Gui, Color, %CustomColor%
Gui, Font, s32, verdana
yPos := 0 ; Initialize y-position variable
xPos := 50 ; Set a fixed x-position
Loop, 4 {
Gui, Add, Text, x%xPos% y%yPos% vnum%A_Index% cFFD166 BackGroundTrans
yPos += 120 ; Increase y-position by 120 for each new line
}
WinSet, TransColor, %CustomColor% 255
SetTimer, UpdateOSD, 200
Gosub, UpdateOSD
; Use calculated position for GUI
Gui, Show, x%GuiX% y%GuiY% w120 h450 NoActivate
return
UpdateOSD:
Loop, 4 {
number := IniReadValue(A_Index)
GuiControl,, num%A_Index%, %number%
}
return
~1::Increment(1)
~2::Increment(2)
~3::Increment(3)
~4::Increment(4)
~+1::Decrement(1)
~+2::Decrement(2)
~+3::Decrement(3)
~+4::Decrement(4)
F12::Reload
+ESC::ExitApp
; Functions
Increment(key) {
UpdateIniFile(key, 1)
}
Decrement(key) {
UpdateIniFile(key, -1)
}
UpdateIniFile(key, change) {
number := IniReadValue(key)
number += change
if (number > 3) {
number := 0
} else if (number < 0) {
number := 3
}
IniWrite, %number%, C:\temp\hook.ini, %key%, %key%
}
IniReadValue(key) {
IniRead, number, C:\temp\hook.ini, %key%, %key%
return number
}