-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMeasure(ReMod).ahk
More file actions
executable file
·128 lines (120 loc) · 3.07 KB
/
Measure(ReMod).ahk
File metadata and controls
executable file
·128 lines (120 loc) · 3.07 KB
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
;============
;
;Shift + LButton + drag to make your box in all directions
;Shift + Control + LButton + Drag to move the window(Not necessary to click on the GUI to move it)
;Shift + RButton + Drag to resize the GUI in from ">v"(Drag right and down).
;
;============
#SingleInstance Force
MsgBox, 64, Controls for Measure, Controls:`n`nWhen you are ready, press and hold 'Shift'. Continue holding while using the folowing 'HotKeys':`n`nLButton:: drag the mouse in any direction to draw a box`nCtrl + LButton:: Move the created box.`nRButton:: Resize the box.`n`n*Note: 'Shift' is a toggle. Press + hold starts the tool, and release to exit.
Gx := 1
;============
; Draw
+LButton::
;
;============
{
Gui, 11:Destroy
CoordMode, Mouse, Screen
KeyWait, LButton, D
MouseGetPos, dx, dy, dt
x := 0 - dx
y := 0 - dy
Gui, 11:Color, 0xFF00FF ; % CC
Gui, 11: +ToolWindow -Caption
Gui, 11: +AlwaysOnTop
Gui, 11: +Border
Gui, 11:Show,, Click2ID Measure
Loop
{
MouseGetPos, hx, hy, ht
setw := abs(x + hx)
seth := abs(y + hy)
ToolTip, % "Width: " . abs(x + hx) . "`nHeight: " . abs(y + hy)
If (dx < hx) and (dy < hy)
{
; Right and down >v
Gui, 11:Show, % "x"(dx) "y"(dy) "w"(hx - dx) "h"(hy - dy), Click2ID Measure
}
If(dx < hx) and (dy > hy)
{
; Right and up >^
Gui, 11:Show, % "x"(dx) "y"(hy) "w"(hx - dx) "h"(dy - hy), Click2ID Measure
}
If (dx > hx) and (dy < hy)
{
; Left and down <v
Gui, 11:Show, % "x"(hx) "y"(dy) "w"(dx - hx) "h"(hy - dy), Click2ID Measure
}
If (dx > hx) and (dy > hy)
{
; Left and up <^
Gui, 11:Show, % "x"(hx) "y"(hy) "w"(dx - hx) "h"(dy - hy), Click2ID Measure
}
WinSet, TransColor, 0xFFFFFF 120, Click2ID Measure ; % CC
If Not GetKeyState("LButton", "P")
{
Break
}
If Not GetKeyState("Shift", "P")
{
ExitApp
}
}
}
Return
;============
; Move
*^LButton::
;
;============
{
CoordMode, Mouse, Screen
WinGetPos, MoveX, MoveY, ffw, ffh, Click2ID Measure
KeyWait, LButton, D
MouseGetPos, mvdx, mvdy
xx := mvdx - MoveX
yy := mvdy - MoveY
Gui, 11:Show,, Click2ID Measure
Loop
{
MouseGetPos, qx, qy
Gui, 11:Show, % "x"(qx - xx) "y"(qy - yy), Click2ID Measure
If not GetKeyState("lButton", "P")
{
Break
}
}
}
Return
;============
; Resize
*RButton::
;
;============
{
CoordMode, Mouse, Screen
WinGetPos, ReszX, ReszY, ReszW, ReszH, Click2ID Measure
MousMv_X := ReszX + ReszW
MousMv_Y := ReszY + ReszH
MouseMove, %MousMv_X%, %MousMv_Y%, 0
MouseGetPos, ddx, ddy
dfx := ReszW - ddx
dfy := ReszH - ddy
Loop
{
MouseGetPos, hhx, hhy, ht
ww := dfx + hhx
hh := dfy + hhy
Gui, 11:Show, x%ReszX% y%ReszY% w%ww% h%hh%, Click2ID Measure
If Not GetKeyState("RButton", "P")
{
Break
}
}
}
Return
*~Shift Up::
Gui, 11:Destroy
MsgBox, 64,New measurement, Your selected box measurement is:`nWidth: %setw%`nHeight: %seth%
ExitApp