-
Notifications
You must be signed in to change notification settings - Fork 3
/
mouser6.ahk
450 lines (426 loc) · 9.66 KB
/
mouser6.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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
;
; AutoHotkey Version: 1.x
; Language: English
; Platform: Win9x/NT
; Author: Adam Pash <adam.pash@gmail.com>
;
; Script Function:
; Template script (you can customize this template by editing "ShellNew\Template.ahk" in your Windows folder)
;
#SingleInstance,Force
SetWinDelay,0
Gosub,INI
Gosub,TRAYMENU
visualizations := visualizations
color := Ceil(color)
transparency:=transparency
locator := locator
comma = ","
^+Enter::
Click
return
START:
CoordMode, Mouse
MouseGetPos, current_x, current_y
if locator = 1
{
GoSub, Locate
}
first_y = "y"
first_x = "y"
SysGet, resolution, Monitor
half_x := Ceil(resolutionRight/2)
move_x := current_x
move_y := current_y
full_y := Ceil(resolutionBottom)
floor := Ceil(resolutionBottom)
ceiling := 0
right := Ceil(resolutionRight)
left := 0
box_w := 0
box_y := 0
Loop
{
;MsgBox, New Coordinates: %move_x% x %move_y%
MouseGetPos, current_x, current_y
Input, UserInput, T5 L1, {Enter}{Escape}{Left}{Right}{Up}{Down}, i,%comma%,j,l
IfInString, ErrorLevel, EndKey:Up
{
if first_y = ""
{
box_w_t := resolutionBottom - half_y
move_y := Ceil(current_y - half_y)
floor := current_y
}
if first_y = "y"
{
half_y := current_y/2
floor := current_y
move_y := Ceil(current_y - (half_y))
box_w_t := resolutionBottom
}
half_y := half_y/2
MouseMove, %move_x%, %move_y%
if visualizations = 1
{
;;; Create Window ;;;
Gui,4: +AlwaysOnTop -Caption +LastFound +ToolWindow
Gui,4: Color, Ceil(color)
WinSet, TransColor, EEAAEE %transparency%
Gui,4: Show, x0 y%floor% w%resolutionRight% h%box_w_t% noactivate
}
first_y = ""
}
IfInString, ErrorLevel, EndKey:Down
{
if first_y = "y"
{
half_y := (resolutionBottom - current_y)/2
ceiling := current_y
move_y := Ceil(current_y + half_y)
box_y := ceiling
}
;
if first_y = ""
{
ceiling := current_y
move_y := Ceil(half_y + current_y)
box_y := current_y
}
half_y := half_y/2
MouseMove, %move_x%, %move_y%
if visualizations = 1
{
;;; Create Window ;;;
Gui,3: +AlwaysOnTop -Caption +LastFound +ToolWindow
Gui,3: Color, Ceil(color)
WinSet, TransColor, EEAAEE %transparency%
Gui,3: Show, x0 y0 w%resolutionRight% h%box_y% noactivate
}
first_y = ""
;MsgBox, %move_y%
}
IfInString, ErrorLevel, EndKey:Left
{
if first_x = "y"
{
half_x := current_x/2
right := current_x
move_x := Ceil(current_x - (half_x))
box_w_r := resolutionRight
;floor := floor - half_y/2
}
if first_x = ""
{
box_w_r := resolutionRight - half_x
right := right - half_x
half_x := half_x/2
move_x := Ceil(right - half_x)
}
MouseMove, %move_x%, %move_y%
if visualizations = 1
{
;;; Create Window ;;;
Gui,2: +AlwaysOnTop -Caption +LastFound +ToolWindow
Gui,2: Color, Ceil(color)
WinSet, TransColor, %color% %transparency%
Gui,2: Show, x%right% y0 w%box_w_r% h%resolutionBottom% noactivate
}
first_x = ""
}
IfInString, ErrorLevel, EndKey:Right
{
if first_x = "y"
{
half_x := (resolutionRight - current_x)/2
left := current_x
move_x := Ceil(current_x + half_x)
box_w := left
}
if first_x = ""
{
box_w := box_w + half_x
left := left + half_x
half_x := half_x/2
move_x := Ceil(left + half_x)
}
MouseMove, %move_x%, %move_y%
if visualizations = 1
{
;;; Create Window ;;;
Gui,1: +AlwaysOnTop -Caption +LastFound +ToolWindow
Gui,1: Color, Ceil(color)
WinSet, TransColor, EEAAEE %transparency%
Gui,1: Show, x0 y0 w%box_w% h%resolutionBottom% noactivate
}
first_x = ""
}
IfInString, ErrorLevel, EndKey:Escape
{
Gosub, Quit
}
IfInString, ErrorLevel, EndKey:Enter
{
Gosub, ClickMouse
}
IfInString, ErrorLevel, EndKey:q
{
Gosub, Quit
}
if UserInput=i
{
if first_y = ""
{
box_w_t := resolutionBottom - half_y
move_y := Ceil(current_y - half_y)
floor := current_y
}
if first_y = "y"
{
half_y := current_y/2
floor := current_y
move_y := Ceil(current_y - (half_y))
box_w_t := resolutionBottom
}
half_y := half_y/2
MouseMove, %move_x%, %move_y%
if visualizations = 1
{
;;; Create Window ;;;
Gui,4: +AlwaysOnTop -Caption +LastFound +ToolWindow
Gui,4: Color, Ceil(color)
WinSet, TransColor, EEAAEE %transparency%
Gui,4: Show, x0 y%floor% w%resolutionRight% h%box_w_t% noactivate
}
first_y = ""
}
else if UserInput =,
{
if first_y = "y"
{
half_y := (resolutionBottom - current_y)/2
ceiling := current_y
move_y := Ceil(current_y + half_y)
box_y := ceiling
}
;
if first_y = ""
{
ceiling := current_y
move_y := Ceil(half_y + current_y)
box_y := current_y
}
half_y := half_y/2
MouseMove, %move_x%, %move_y%
if visualizations = 1
{
;;; Create Window ;;;
Gui,3: +AlwaysOnTop -Caption +LastFound +ToolWindow
Gui,3: Color, Ceil(color)
WinSet, TransColor, EEAAEE %transparency%
Gui,3: Show, x0 y0 w%resolutionRight% h%box_y% noactivate
}
first_y = ""
}
else if UserInput =j
{
if first_x = "y"
{
half_x := current_x/2
right := current_x
move_x := Ceil(current_x - (half_x))
box_w_r := resolutionRight
;floor := floor - half_y/2
}
if first_x = ""
{
box_w_r := resolutionRight - half_x
right := right - half_x
half_x := half_x/2
move_x := Ceil(right - half_x)
}
MouseMove, %move_x%, %move_y%
if visualizations = 1
{
;;; Create Window ;;;
Gui,2: +AlwaysOnTop -Caption +LastFound +ToolWindow
Gui,2: Color, Ceil(color)
WinSet, TransColor, %color% %transparency%
Gui,2: Show, x%right% y0 w%box_w_r% h%resolutionBottom% noactivate
}
first_x = ""
}
else if UserInput =l
{
if first_x = "y"
{
half_x := (resolutionRight - current_x)/2
left := current_x
move_x := Ceil(current_x + half_x)
box_w := left
}
if first_x = ""
{
box_w := box_w + half_x
left := left + half_x
half_x := half_x/2
move_x := Ceil(left + half_x)
}
MouseMove, %move_x%, %move_y%
if visualizations = 1
{
;;; Create Window ;;;
Gui,1: +AlwaysOnTop -Caption +LastFound +ToolWindow
Gui,1: Color, Ceil(color)
WinSet, TransColor, EEAAEE %transparency%
Gui,1: Show, x0 y0 w%box_w% h%resolutionBottom% noactivate
}
first_x = ""
}
else if UserInput =k
{
GoSub, ClickMouse
}
else if UserInput =r
{
GoSub, RightClickMouse
Exit
}
if ErrorLevel = Max
{
}
if ErrorLevel = NewInput
return
}
return
Quit:
Gui,1: Destroy
Gui,2: Destroy
Gui,3: Destroy
Gui,4: Destroy
Exit
return
ClickMouse:
Click
Gui,1: Destroy
Gui,2: Destroy
Gui,3: Destroy
Gui,4: Destroy
Exit
return
RightClickMouse:
Click right
Gui,1: Destroy
Gui,2: Destroy
Gui,3: Destroy
Gui,4: Destroy
Exit
return
Locate:
delay := 200
x_pos := Ceil(current_x - 50)
y_pos := Ceil(current_y - 50)
Gui, 5: +AlwaysOnTop -Caption +LastFound +ToolWindow
Gui, 5: Color, FF3333
WinSet, TransColor, %color% %transparency%
Gui,5: Show, x%x_pos% y%y_pos% w100 h100 noactivate
Loop, 1
{
Sleep, %delay%
WinHide
Sleep, %delay%
WinShow
}
Sleep, %delay%
Gui, 5: Destroy
return
INI:
IfNotExist,Mouser.ini
{
IniWrite,^M,Mouser.ini,Settings,hotkey
IniWrite,1,Mouser.ini,Settings,visualizations
IniWrite,FF3333,Mouser.ini,Settings,color
IniWrite,70,Mouser.ini,Settings,transparency
IniWrite,1,Mouser.ini,Settings,locator
}
IniRead,hotkey,Mouser.ini,Settings,hotkey
IniRead,visualizations,Mouser.ini,Settings,visualizations
IniRead,color,Mouser.ini,Settings,color
IniRead,transparency,Mouser.ini,Settings,transparency
IniRead,locator,Mouser.ini,Settings,locator
HotKey,%hotkey%,START
Return
TRAYMENU:
Menu,Tray,NoStandard
Menu,Tray,DeleteAll
Menu,Tray,Add,Mouser,ABOUT
Menu,Tray,Add,
Menu,Tray,Add,&Settings...,SETTINGS
Menu,Tray,Add,&About...,ABOUT
Menu,Tray,Add,E&xit,EXIT
Menu,Tray,Default,Mouser
Menu,Tray,Tip,Mouser
Return
SETTINGS:
HotKey,%hotkey%,Off
Gui,8: Destroy
Gui,8: Add,GroupBox,xm ym w400 h70,&Hotkey
Gui,8: Add,Hotkey,xp+10 yp+20 w380 vshotkey
StringReplace,current,hotkey,+,Shift +%A_Space%
StringReplace,current,current,^,Ctrl +%A_Space%
StringReplace,current,current,!,Alt +%A_Space%
Gui,8: Add,Text,,Current hotkey: %current%
Gui,8: Add, Checkbox, xp+10 yp+28 vslocator_cbox Checked%locator%, Locator (flashes location of mouse when hotkey is pressed)
Gui,8: Add, Checkbox, vsvisualizations_cbox Checked%visualizations%, Screen visualizations (displays area of screen that has been ruled out)
Gui,8: Add,GroupBox,xm y+10 w400 h75,&Visualization Transparency (0 to 250; default:70; currently:%transparency%):
Gui,8: Add, Slider, xp+10 yp+20 w380 vstransparency Range0-250 ToolTipRight TickInterval25, %transparency%
Gui,8: Add,Button,xm y+30 w75 GSETTINGSOK,&OK
Gui,8: Add,Button,x+5 w75 GSETTINGSCANCEL,&Cancel
Gui,8: Show,,Mouser Settings
Return
SETTINGSOK:
Gui,8: Submit
If shotkey<>
{
hotkey:=shotkey
HotKey,%hotkey%,START
}
HotKey,%hotkey%,On
If stransparency<>
transparency:=stransparency
If slocator<>
locator = %slocator%
if slocator_cbox<>
locator := slocator_cbox
if svisualizations_cbox<>
visualizations := svisualizations_cbox
IniWrite,%hotkey%,Mouser.ini,Settings,hotkey
IniWrite,%visualizations%,Mouser.ini,Settings,visualizations
IniWrite,%transparency%,Mouser.ini,Settings,transparency
IniWrite,%locator%,Mouser.ini,Settings,locator
IniWrite,%checkbox%, Mouser.ini, Settings,checkbox
Gui, 8: Destroy
Return
SETTINGSCANCEL:
HotKey,%hotkey%,START,On
HotKey,%hotkey%,On
Gui,8: Destroy
Return
ABOUT:
Gui,Destroy
Gui,Font,Bold
Gui,Add,Text,x+10 yp+10,Mouser v1.0 - by Adam Pash
Gui,Font
Gui,Add,Text,xm,Press Ctrl+M to locate and move the mouse.
Gui,Add,Text,xm,To change the settings, choose Settings in the tray menu.
Gui,Add,Text,xm y+15,Made using AutoHotkey
Gui,Font
Gui,Font
Gui,Add,Text,xm,For more Autohotkey love, check out:
Gui, Font, Bold
Gui,Add,Text,xm,http://lifehacker.com/software/autohotkey
Gui,Show,,ShiftOff About
about=
Return
EXIT:
ExitApp