-
Notifications
You must be signed in to change notification settings - Fork 4
/
ScreenHelper.ahk
114 lines (92 loc) · 1.71 KB
/
ScreenHelper.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
; =======================================
;
; Simple script to show the mouse
; coordinates and detect on-screen colors
;
; F6 to copy the current color
; F7 to copy the current coordinates
; F8 to copy both color and coordinates
;
; F12 to toggle the helping tooltip
;
; Use the arrow keys to move the cursor
; by 1 pixel
;
; =======================================
#Requires AutoHotkey v2.0-beta
#SingleInstance Force
; Rerun script with the administrator privileges if required
If (not A_IsAdmin) {
Try {
Run '*RunAs "' A_ScriptFullPath '"'
} Catch {
MsgBox "Failed to run the script with administrator privileges"
}
ExitApp
}
Global Toggle := True
CoordMode "Mouse", "Client"
SetTimer WatchCursor, 100
~*f6:: {
MouseGetPos &x, &y
color := PixelGetColor(x, y)
A_Clipboard := color
x += 10
y -= 30
ToolTip "Copied! " color, x, y, 2
Sleep 1000
ToolTip , , , 2
}
~*f7:: {
MouseGetPos &x, &y
Coords := x ", " y
A_Clipboard := Coords
x += 10
y -= 30
ToolTip "Copied! " Coords, x, y, 2
Sleep 1000
ToolTip , , , 2
}
~*f8:: {
MouseGetPos &x, &y
color := PixelGetColor(x, y)
Coords := 'IsColor(' x ', ' y ', "' color '")'
A_Clipboard := Coords
x += 10
y -= 30
ToolTip "Copied! " x ", " y " : " color, x, y, 2
Sleep 1000
ToolTip , , , 2
}
*Up:: {
MouseGetPos &x, &y
MouseMove x, y - 1
}
*Down:: {
MouseGetPos &x, &y
MouseMove x, y + 1
}
*Left:: {
MouseGetPos &x, &y
MouseMove x - 1, y
}
*Right:: {
MouseGetPos &x, &y
MouseMove x + 1, y
}
*f12:: {
Global
Toggle := !Toggle
If (Toggle)
Return
ToolTip
ToolTip , , , 2
}
WatchCursor() {
Global
If (not Toggle)
Return
MouseGetPos &x, &y
color := PixelGetColor(x, y)
ToolTip x " " y "`nColor: " color "`nF6-F8: Color, Coords, Both"
}