Skip to content

Commit e1134e2

Browse files
committed
Added a disabling hotkey and updated messages
1 parent 4624084 commit e1134e2

File tree

3 files changed

+28
-6
lines changed

3 files changed

+28
-6
lines changed

ClickFix.ahk

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ SetWorkingDir %A_ScriptDir%
77

88
; --- Actual program ---
99

10-
ver := "2.4.1"
10+
ver := "2.5.1"
1111
settings_file = ClickFix_Settings.ini
1212
startup_shortcut := A_Startup . "\ClickFix.lnk"
1313
settings := Object()
@@ -21,6 +21,7 @@ settings["lpr"] := ["General", "left_pressure", 25, "Left click"]
2121
settings["mpr"] := ["General", "middle_pressure", 25, "Middle click"]
2222
settings["rpr"] := ["General", "right_pressure", 25, "Right click"]
2323
settings["sww"] := ["General", "startup_run", false]
24+
settings["dis"] := ["General", "disabled", false]
2425

2526
; Initialize Last-click times
2627
last_m_down := 0
@@ -64,6 +65,9 @@ Menu, Tray, Add, Reset, reset
6465
Menu, Tray, Add, Exit, exit
6566
Menu, Tray, Tip, ClickFix - Tame your mouse
6667

68+
; Set the App Icon
69+
setTrayIcon()
70+
6771
; Define the settings GUI
6872
settingsGui() {
6973
global
@@ -76,7 +80,7 @@ settingsGui() {
7680
Gui, Settings:font, s18, Arial
7781
Gui, Settings:Add, Text, Center W500, ClickFix Settings
7882
Gui, Settings:font, s8 c808080, Trebuchet MS
79-
Gui, Settings:Add, Text, Center W500 yp+26, Copyright (c) 2016 Jason Cemra
83+
Gui, Settings:Add, Text, Center W500 yp+26, Copyright (c) 2017 Jason Cemra
8084

8185
; Leading Paragraph
8286
Gui, Settings:font, s10 c101013, Arial
@@ -117,6 +121,11 @@ settingsGui() {
117121
loadSettingsToGui()
118122
settingsCheckBoxes()
119123
Gui, show, W530 H345 center, ClickFix Settings
124+
125+
; Show a warning if the program is disabled
126+
If (settings["dis"][3]) {
127+
MsgBox, 0x30, Warning, ClickFix Disabled. Press Ctrl + Shift + ~ to toggle this.
128+
}
120129
}
121130

122131
; GUI Actions
@@ -228,11 +237,24 @@ updateTrayMenuState(){
228237
Menu, options, UnCheck, Start With Windows
229238
}
230239
}
240+
setTrayIcon(){
241+
global
242+
If (settings["dis"][3]) {
243+
Menu, Tray, Icon, ./icon/ClickFix-icon-disabled.ico
244+
} else {
245+
Menu, Tray, Icon, ./icon/ClickFix-icon.ico
246+
}
247+
}
231248

232249
updateTrayMenuState()
233250
Sleep, 500 ; There seems to be an issue with the startup shortcut disappearing
234251
update_sww_state(settings["sww"][3])
235252

253+
; Use a hotkey to enable/disable the software functionality
254+
^+`::
255+
settings["dis"][3] := !settings["dis"][3]
256+
setTrayIcon()
257+
save()
236258
return
237259

238260

@@ -332,7 +354,7 @@ startup_shortcut_destroy() {
332354
about() {
333355
global ver
334356
Gui, Settings:+OwnDialogs
335-
MsgBox, 0x40, Welcome to ClickFix!, % "Thank you for using ClickFix!`n`nClickFix is always available from the taskbar tray area (if it's running). Whether ClickFix works for you or it doesn't, send me a message! I'm always looking for ways to improve the software: [email protected].`n`nThis software is at version " . ver . ".`nCopyright 2016 Jason Cemra - released under the GPLv3.`nSpecial thanks to the AutoHotKey crew, for making this program easy to write."
357+
MsgBox, 0x40, Welcome to ClickFix!, % "Thank you for using ClickFix!`n`nClickFix is always available from the taskbar tray area (if it's running). Remember, ClickFix makes an unusable mouse into a bearable one until a replacement can be made. You may experience issues with the mouse not clicking at times - simply right click on the tray icon to restart the program.`n`nThis software is at version " . ver . ".`nCopyright 2017 Jason Cemra - released under the GPLv3.`nSpecial thanks to the AutoHotKey crew, for making this program easy to write."
336358
}
337359

338360
restart() {
@@ -343,7 +365,7 @@ restart() {
343365

344366

345367
; The real logic of the program - hotkeys triggered by mouse events
346-
#If, settings["mb"][3]
368+
#If, settings["mb"][3] and !settings["dis"][3]
347369
MButton::
348370
if (A_TickCount - last_m_down >= slidePressureScale(settings["mpr"][3]) && A_TickCount - last_m_up >= slidePressureScale(settings["mpr"][3])) {
349371
Send {Blind}{MButton Down}
@@ -358,7 +380,7 @@ if (A_TickCount - last_m_up >= slidePressureScale(settings["mpr"][3])) {
358380
}
359381
return
360382

361-
#If, settings["lb"][3]
383+
#If, settings["lb"][3] and !settings["dis"][3]
362384
LButton::
363385
Critical
364386
if (A_TickCount - last_l_down >= slidePressureScale(settings["lpr"][3]) && A_TickCount - last_l_up >= slidePressureScale(settings["lpr"][3])) {
@@ -374,7 +396,7 @@ if (A_TickCount - last_l_up >= slidePressureScale(settings["lpr"][3])) {
374396
}
375397
return
376398

377-
#If, settings["rb"][3]
399+
#If, settings["rb"][3] and !settings["dis"][3]
378400
*RButton::
379401
if (A_TickCount - last_r_down >= slidePressureScale(settings["rpr"][3]) && A_TickCount - last_r_up >= slidePressureScale(settings["rpr"][3])) {
380402
Send {Blind}{RButton Down}

icon/ClickFix Logo Disabled.png

54.3 KB
Loading

icon/clickfix-icon-disabled.ico

43 KB
Binary file not shown.

0 commit comments

Comments
 (0)