@@ -60,7 +60,7 @@ SZ_TABLE := {
60
60
61
61
program_logs := []
62
62
is_autoclicking := false
63
- always_on_top := true
63
+ is_always_on_top_on := true
64
64
65
65
configured_hotkeys := []
66
66
are_hotkeys_active := true
@@ -71,7 +71,6 @@ makeRadioGroup(name, radioControls, changedCallback := 0) {
71
71
radioControls[1 ].Name := name
72
72
RadioGroups.%name% := { Controls: radioControls, Callback: changedCallback }
73
73
if changedCallback {
74
- local ctrl
75
74
for ctrl in radioControls
76
75
ctrl .OnEvent(" Click" , changedCallback)
77
76
}
@@ -82,7 +81,6 @@ makeCheckable(name, checkbox, callback := 0, controls := []) {
82
81
if callback = 1 {
83
82
checkbox.OnEvent(" Click" , Toggle)
84
83
Toggle (* ) {
85
- local ctrl
86
84
for ctrl in controls
87
85
ctrl .Enabled := checkbox.Value
88
86
}
@@ -355,10 +353,26 @@ add_log(text) {
355
353
program_logs.RemoveAt(1 )
356
354
}
357
355
356
+ setupOptionsMenu () {
357
+ for optionInfo in PersistentOptions {
358
+ OptionsMenu.Add(optionInfo.Text, OptionsMenuItemCallbackWrapper)
359
+
360
+ optionInfo.CurrentSetting := RegRead (REG_KEY_PATH, optionInfo.ValueName, optionInfo.Default)
361
+
362
+ if optionInfo.CurrentSetting ! = optionInfo.Default
363
+ optionInfo.Toggler()
364
+ if optionInfo.CurrentSetting
365
+ OptionsMenu.Check(optionInfo.Text)
366
+ }
367
+
368
+ OptionsMenu.Add()
369
+ OptionsMenu.Add(SZ_TABLE.Menu_Options_ResetToDefault, ResetOptionsToDefault)
370
+ }
371
+
358
372
showGuiAtAutoclickerGuiPos (gui ) {
359
373
local posX, posY
360
374
AutoclickerGui.GetPos(& posX, & posY)
361
- gui .Opt((always_on_top ? " +" : " -" ) " AlwaysOnTop" )
375
+ gui .Opt((is_always_on_top_on ? " +" : " -" ) " AlwaysOnTop" )
362
376
gui .Show(" x" posX " y" posY)
363
377
}
364
378
@@ -397,7 +411,6 @@ validateProfileNameInput(profileName) {
397
411
}
398
412
399
413
formatHotkeyText (hotkey ) {
400
- local k, v
401
414
for k, v in Map(" ~" , "" , " ^" , " {ctrl}" , " !" , " {alt}" , " +" , " {shift}" )
402
415
hotkey := StrReplace (hotkey , k, v)
403
416
return hotkey
@@ -461,7 +474,6 @@ Positioning_ChangedModeSelection(radio, *) {
461
474
Hotkeys_updateHotkeyBindings () {
462
475
AutoclickerGui[" Hotkeys_HotkeyList_ListView" ].Delete ()
463
476
464
- local hotkeyData
465
477
for hotkeyData in configured_hotkeys {
466
478
AutoclickerGui[" Hotkeys_HotkeyList_ListView" ].Add(
467
479
, hotkeyData.Action = 1 ? " Start"
@@ -478,7 +490,6 @@ Hotkeys_updateHotkeyBindings() {
478
490
479
491
HotkeyEvent (hotkey ) {
480
492
local hotkeyData
481
- local hDat
482
493
for hDat in configured_hotkeys {
483
494
if hDat.Hotkey = hotkey {
484
495
hotkeyData := hDat
@@ -551,9 +562,6 @@ Hotkeys_AddHotkey(*) {
551
562
Submit (* ) {
552
563
hideOwnedGui(KeyBinderGui)
553
564
554
- local hotkeyText := formatHotkeyText(KeyBinderGui[" Hotkey" ].Value)
555
-
556
- local hotkeyData
557
565
for hotkeyData in configured_hotkeys {
558
566
if " ~" KeyBinderGui[" Hotkey" ].Value = hotkeyData.Hotkey {
559
567
if MsgBox (
@@ -568,6 +576,8 @@ Hotkeys_AddHotkey(*) {
568
576
}
569
577
}
570
578
579
+ local hotkeyText := formatHotkeyText(KeyBinderGui[" Hotkey" ].Value)
580
+
571
581
configured_hotkeys.Push {
572
582
Hotkey : " ~" KeyBinderGui[" Hotkey" ].Value,
573
583
HotkeyText: hotkeyText,
@@ -589,7 +599,6 @@ Hotkeys_RemoveHotkey(*) {
589
599
if ! rowNum
590
600
break
591
601
592
- local hotkeyData
593
602
for hotkeyData in configured_hotkeys {
594
603
if hotkeyData.HotkeyText = AutoclickerGui[" Hotkeys_HotkeyList_ListView" ].GetText(rowNum, 3 ) {
595
604
configured_hotkeys.RemoveAt(A_Index )
@@ -605,7 +614,6 @@ Hotkeys_RemoveHotkey(*) {
605
614
}
606
615
607
616
Hotkeys_ClearAllHotkeys (* ) {
608
- local hotkeyData
609
617
for hotkeyData in configured_hotkeys {
610
618
configured_hotkeys.Delete (A_Index )
611
619
Hotkey hotkeyData.Hotkey , " Off"
@@ -652,7 +660,6 @@ ProfileCreate(*) {
652
660
653
661
RegCreateKey REG_KEY_PATH " \Profiles\" profileName
654
662
655
- local ctrlName, value
656
663
for ctrlName, value in currentConfig.OwnProps() {
657
664
if ! InStr (ctrlName, " _" )
658
665
continue
@@ -663,9 +670,9 @@ ProfileCreate(*) {
663
670
}
664
671
665
672
local serializedHotkeys := ""
666
- local hotkeyData
667
673
for hotkeyData in configured_hotkeys
668
674
serializedHotkeys .= hotkeyData.Hotkey " %" hotkeyData.Scope " %" hotkeyData.Action " `n"
675
+
669
676
RegWrite serializedHotkeys
670
677
, " REG_MULTI_SZ"
671
678
, REG_KEY_PATH " \Profiles\" profileName
@@ -832,7 +839,6 @@ ProfileManage(*) {
832
839
local fileLocations := FileSelect(" M" ,
833
840
, " Import Autoclicker Profile(s)" , " Autoclicker Profiles (*" FILE_EXT " )"
834
841
)
835
- local fileLocation
836
842
for fileLocation in fileLocations {
837
843
add_log(" Importing profile from " fileLocation)
838
844
@@ -853,7 +859,6 @@ ProfileManage(*) {
853
859
854
860
RegCreateKey REG_KEY_PATH " \Profiles\" profileName
855
861
856
- local err
857
862
try {
858
863
Loop Parse FileRead (fileLocation), " `n" {
859
864
if ! A_LoopField
@@ -902,7 +907,6 @@ ProfileLoad(profileName, *) {
902
907
return
903
908
}
904
909
905
- local err
906
910
try {
907
911
Loop Reg REG_KEY_PATH " \Profiles\" profileName {
908
912
local value := RegRead ()
@@ -988,7 +992,6 @@ LogsOpen(*) {
988
992
RefreshLogs (* ) {
989
993
LogsGui[" List" ].Delete ()
990
994
991
- local data
992
995
for data in program_logs {
993
996
LogsGui[" List" ].Add(, FormatTime (data.Timestamp, " HH:mm:ss" ), data.Message)
994
997
}
@@ -998,8 +1001,8 @@ LogsOpen(*) {
998
1001
}
999
1002
1000
1003
toggleAlwaysOnTop (optionInfo ) {
1001
- global always_on_top := optionInfo.CurrentSetting
1002
- AutoclickerGui.Opt((always_on_top ? " +" : " -" ) " AlwaysOnTop" )
1004
+ global is_always_on_top_on := optionInfo.CurrentSetting
1005
+ AutoclickerGui.Opt((is_always_on_top_on ? " +" : " -" ) " AlwaysOnTop" )
1003
1006
}
1004
1007
1005
1008
toggleHotkeysActive (optionInfo ) {
@@ -1033,7 +1036,6 @@ ResetOptionsToDefault(*) {
1033
1036
RegDelete
1034
1037
}
1035
1038
1036
- local optionInfo
1037
1039
for optionInfo in PersistentOptions {
1038
1040
if optionInfo.CurrentSetting ! = optionInfo.Default {
1039
1041
optionInfo.CurrentSetting := optionInfo.Default
@@ -1211,7 +1213,6 @@ Your current version is {}. Would you like to update now?
1211
1213
1212
1214
add_log(" Downloading file" )
1213
1215
1214
- local err
1215
1216
try
1216
1217
Download " https://github.com/" GITHUB_REPO " /releases/latest/download/EC-Autoclicker.exe"
1217
1218
, downloadFilePath
@@ -1231,16 +1232,7 @@ Your current version is {}. Would you like to update now?
1231
1232
}
1232
1233
}
1233
1234
1234
- for optionInfo in PersistentOptions {
1235
- OptionsMenu.Add optionInfo.Text, OptionsMenuItemCallbackWrapper
1236
- optionInfo.CurrentSetting := RegRead (REG_KEY_PATH, optionInfo.ValueName, optionInfo.Default)
1237
- if optionInfo.CurrentSetting ! = optionInfo.Default
1238
- optionInfo.Toggler()
1239
- if optionInfo.CurrentSetting
1240
- OptionsMenu.Check(optionInfo.Text)
1241
- }
1242
- OptionsMenu.Add()
1243
- OptionsMenu.Add(SZ_TABLE.Menu_Options_ResetToDefault, ResetOptionsToDefault)
1235
+ setupOptionsMenu()
1244
1236
1245
1237
if A_Args.Length > 0 && A_Args[1 ] = " /profile" {
1246
1238
add_log(" Detected /profile switch" )
0 commit comments