-
Notifications
You must be signed in to change notification settings - Fork 7
/
MouseJiggler.ahk
108 lines (93 loc) · 2.92 KB
/
MouseJiggler.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
#Persistent
#SingleInstance ignore
SetTimer, MoveMouse, 1000
appName = Mouse Jiggler
appVersion = v1.2.00
jiggleTime = 60000
Gui, -MinimizeBox -Resize
Gui, Font, S16 CDefault Bold, Sans-Serif
Gui, Add, Text, x10 y10 w330 h30 +Center +BackgroundTrans, %appName% %appVersion%
Gui, Font, S12 CDefault Norm, Sans-Serif
Gui, Add, Text, x10 y45 w330 h30 +Center +BackgroundTrans, by Steve Reich
Gui, Font, S8 CDefault Norm, Sans-Serif
Gui, Add, Text, x10 y68 w330 h30 +Center +BackgroundTrans, @2018 Boxshadow Studios
Gui, Add, Button, x125 y105 w100 h26 Default gGuiClose, &Close
Menu, tray, NoStandard
Menu, tray, tip, Active
Menu, tray, add, Pause Jiggler, PauseJiggle
Menu, tray, add, Run on Startup, startUpReg
Menu, tray, add
Menu, tray, add, About..., GuiOpen
Menu, tray, add, Exit, exitHandler
Menu, tray, Default, About...
Menu, tray, Click, 1
RegRead, isFirstTime, HKCU, SOFTWARE\%appName%, ExePath
if ErrorLevel {
RegWrite, REG_SZ, HKCU, SOFTWARE\%appName%, ExePath, %A_ScriptFullPath%
RegWrite, REG_SZ, HKCU, SOFTWARE\%appName%, isPaused, 0
}
RegRead, pauseState, HKCU, SOFTWARE\%appName%, isPaused
if (ErrorLevel = 0) {
state = active
opt = 17
if pauseState {
SetTimer, MoveMouse, Off
Menu, tray, Rename, Pause Jiggler, Resume Jiggler
Menu, tray, tip, Paused
state = paused
opt = 2
}
TrayTip ,, %appName% is %state%., 3, %opt%
}
RegRead, startUp, HKCU, SOFTWARE\Microsoft\Windows\CurrentVersion\Run, %appName%
if (ErrorLevel = 0) {
RegWrite, REG_SZ, HKCU, SOFTWARE\Microsoft\Windows\CurrentVersion\Run, %appName%, %A_ScriptFullPath%
Menu, Tray, Check, Run on Startup
}
return
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AUTO EXEC SECTION ENDS HERE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
MoveMouse:
if (A_TimeIdle > jiggleTime) {
MouseMove, 50, 0, 10, R
MouseMove, -50, 0, 10, R
SendInput {RShift}
}
return
PauseJiggle:
if(A_ThisMenuItem = "Pause Jiggler"){
SetTimer, MoveMouse, Off
RegWrite, REG_SZ, HKCU, SOFTWARE\%appName%, isPaused, 1
Menu, tray, Rename, Pause Jiggler, Resume Jiggler
Menu, tray, tip, Paused
}
else{
SetTimer, MoveMouse, On
RegWrite, REG_SZ, HKCU, SOFTWARE\%appName%, isPaused, 0
Menu, tray, Rename, Resume Jiggler, Pause Jiggler
Menu, tray, tip, Active
}
return
startUpReg:
RegRead, startUp, HKCU, SOFTWARE\Microsoft\Windows\CurrentVersion\Run, %appName%
if ErrorLevel {
RegWrite, REG_SZ, HKCU, SOFTWARE\Microsoft\Windows\CurrentVersion\Run, %appName%, %A_ScriptFullPath%
Menu, Tray, Check, %A_ThisMenuItem%
}
else{
RegDelete, HKCU, SOFTWARE\Microsoft\Windows\CurrentVersion\Run, %appName%
if ErrorLevel {
reload
}
Menu, Tray, Uncheck, %A_ThisMenuItem%
}
return
GuiOpen:
Gui, Show, w350 h145, About %appName%
return
GuiClose:
Gui, Cancel
return
exitHandler:
ExitApp