@@ -11,7 +11,6 @@ GITHUB_REPO := "Expertcoderz/EC-Autoclicker"
11
11
12
12
FILE_EXT := " .ac-profile"
13
13
REG_KEY_PATH := " HKCU\Software\Expertcoderz\Autoclicker"
14
- RegCreateKey REG_KEY_PATH " \Profiles"
15
14
16
15
SZ_TABLE := {
17
16
; Menus
@@ -27,6 +26,7 @@ SZ_TABLE := {
27
26
Menu_Profiles_Create: " &Save..." ,
28
27
Menu_Profiles_Manage: " &Manage" ,
29
28
; Options Menu
29
+ Menu_Options_SimplifiedView: " &Simplified View" ,
30
30
Menu_Options_AlwaysOnTop: " &Always On Top" ,
31
31
Menu_Options_MinButtonVisible: " &Minimize Button Visible" ,
32
32
Menu_Options_EscToClose: " &ESC To Close" ,
@@ -60,6 +60,7 @@ SZ_TABLE := {
60
60
61
61
program_logs := []
62
62
is_autoclicking := false
63
+ is_simplified_view_on := false
63
64
is_always_on_top_on := true
64
65
65
66
configured_hotkeys := []
@@ -106,22 +107,16 @@ FileMenu.Add(SZ_TABLE.Menu_File_Logs, LogsOpen)
106
107
FileMenu.Add(SZ_TABLE.Menu_File_Exit, Close )
107
108
108
109
ProfilesMenu := Menu ()
109
- setupProfiles () {
110
- ProfilesMenu.Delete ()
111
- ProfilesMenu.Add(SZ_TABLE.Menu_Profiles_Create, ProfileCreate)
112
- ProfilesMenu.Add(SZ_TABLE.Menu_Profiles_Manage, ProfileManage)
113
- ProfilesMenu.Add()
114
-
115
- Loop Reg REG_KEY_PATH " \Profiles" , " K"
116
- ProfilesMenu.Add(A_LoopRegName , ProfileLoad)
117
-
118
- add_log(" Loaded profiles" )
119
- }
120
- setupProfiles()
121
110
122
111
OptionsMenu := Menu ()
123
112
124
113
PersistentOptions := [
114
+ {
115
+ ValueName: " SimplifiedView" ,
116
+ Default : false ,
117
+ Text : SZ_TABLE.Menu_Options_SimplifiedView,
118
+ Toggler: toggleSimplifiedView
119
+ },
125
120
{
126
121
ValueName: " AlwaysOnTop" ,
127
122
Default : true ,
@@ -334,6 +329,9 @@ AutoclickerGui.AddButton("yp wp vHotkeys_ClearAllHotkeys_Button", "&Clear All")
334
329
335
330
AutoclickerGui[" Tab" ].UseTab()
336
331
332
+ AutoclickerGui.AddText(" xm ym vSimplifiedViewHeaderText Hidden" , " Select a profile:" )
333
+ AutoclickerGui.AddListBox(" xp yp+20 w248 h188 vSimplifiedViewListBox Hidden Sort 0x100" )
334
+
337
335
AutoclickerGui.AddButton(" xm w121 vStartButton Default" , " START" )
338
336
.OnEvent(" Click" , Start)
339
337
AutoclickerGui.AddButton(" yp wp vStopButton Disabled" , " STOP" )
@@ -353,6 +351,39 @@ add_log(text) {
353
351
program_logs.RemoveAt(1 )
354
352
}
355
353
354
+ refreshProfileSelectionLists () {
355
+ ProfilesMenu.Delete ()
356
+ ProfilesMenu.Add(SZ_TABLE.Menu_Profiles_Create, ProfileCreate)
357
+ ProfilesMenu.Add(SZ_TABLE.Menu_Profiles_Manage, ProfileManage)
358
+ ProfilesMenu.Add()
359
+
360
+ if is_simplified_view_on
361
+ ProfilesMenu.Disable(SZ_TABLE.Menu_Profiles_Create)
362
+ else
363
+ ProfilesMenu.Enable(SZ_TABLE.Menu_Profiles_Create)
364
+
365
+ AutoclickerGui[" SimplifiedViewListBox" ].Delete ()
366
+
367
+ local numProfiles := 0
368
+ Loop Reg REG_KEY_PATH " \Profiles" , " K" {
369
+ numProfiles++
370
+ ProfilesMenu.Add(A_LoopRegName , ProfileLoad)
371
+ AutoclickerGui[" SimplifiedViewListBox" ].Add([A_LoopRegName ])
372
+ }
373
+
374
+ if numProfiles < 1 {
375
+ if is_simplified_view_on
376
+ AutoclickerGui[" StartButton" ].Enabled := false
377
+ else
378
+ AutoclickerGui[" StartButton" ].Enabled := ! is_autoclicking
379
+ } else {
380
+ AutoclickerGui[" SimplifiedViewListBox" ].Value := 1
381
+ AutoclickerGui[" StartButton" ].Enabled := ! is_autoclicking
382
+ }
383
+
384
+ add_log(" Loaded " numProfiles " profile(s)" )
385
+ }
386
+
356
387
setupOptionsMenu () {
357
388
for optionInfo in PersistentOptions {
358
389
OptionsMenu.Add(optionInfo.Text, OptionsMenuItemCallbackWrapper)
@@ -662,7 +693,11 @@ ProfileCreate(*) {
662
693
663
694
for ctrlName, value in currentConfig.OwnProps() {
664
695
if ! InStr (ctrlName, " _" )
696
+ ; Ignore any controls (e.g. SimplifiedViewListBox) that lack
697
+ ; underscores in their names since they are not part of the
698
+ ; profile configuration.
665
699
continue
700
+
666
701
RegWrite value
667
702
, ctrlName ~ = " DateTime" ? " REG_SZ" : " REG_DWORD"
668
703
, REG_KEY_PATH " \Profiles\" profileName
@@ -680,7 +715,7 @@ ProfileCreate(*) {
680
715
681
716
add_log(" Wrote configuration data to registry" )
682
717
683
- setupProfiles ()
718
+ refreshProfileSelectionLists ()
684
719
hideOwnedGui(ProfileNamePromptGui)
685
720
}
686
721
}
@@ -715,7 +750,7 @@ ProfileManage(*) {
715
750
ProfilesGui[" ProfileList" ].Add(A_LoopRegName = selectProfileName ? " +Focus +Select" : "" , A_LoopRegName )
716
751
717
752
ProfileListSelectionChanged()
718
- setupProfiles ()
753
+ refreshProfileSelectionLists ()
719
754
}
720
755
721
756
ProfileListSelectionChanged (* ) {
@@ -787,14 +822,12 @@ ProfileManage(*) {
787
822
ProfilesGui.Opt(" -Disabled" )
788
823
WinActivate " ahk_id " ProfilesGui.Hwnd
789
824
refreshProfileList(profileNewName)
790
- setupProfiles()
791
825
return
792
826
}
793
827
}
794
828
MsgBox " The profile '" selectedProfileName " ' does not exist or has been deleted." , " Error" , " Iconx 8192"
795
829
ProfileRenamePromptGui.Opt(" -Disabled" )
796
830
refreshProfileList()
797
- setupProfiles()
798
831
}
799
832
800
833
CancelPrompt (* ) {
@@ -903,7 +936,7 @@ ProfileLoad(profileName, *) {
903
936
add_log(" Loading profile '" profileName " '" )
904
937
905
938
if ! assertProfileExists(profileName) {
906
- setupProfiles ()
939
+ refreshProfileSelectionLists ()
907
940
return
908
941
}
909
942
@@ -1000,6 +1033,15 @@ LogsOpen(*) {
1000
1033
}
1001
1034
}
1002
1035
1036
+ toggleSimplifiedView (optionInfo ) {
1037
+ global is_simplified_view_on := optionInfo.CurrentSetting
1038
+ AutoclickerGui[" Tab" ].Visible := ! is_simplified_view_on
1039
+ AutoclickerGui[" SimplifiedViewHeaderText" ].Visible := is_simplified_view_on
1040
+ AutoclickerGui[" SimplifiedViewListBox" ].Visible := is_simplified_view_on
1041
+
1042
+ refreshProfileSelectionLists()
1043
+ }
1044
+
1003
1045
toggleAlwaysOnTop (optionInfo ) {
1004
1046
global is_always_on_top_on := optionInfo.CurrentSetting
1005
1047
AutoclickerGui.Opt((is_always_on_top_on ? " +" : " -" ) " AlwaysOnTop" )
@@ -1076,6 +1118,9 @@ Start(*) {
1076
1118
AutoclickerGui[" StopButton" ].Enabled := true
1077
1119
AutoclickerGui[" StopButton" ].Focus()
1078
1120
1121
+ if is_simplified_view_on
1122
+ ProfileLoad(AutoclickerGui[" SimplifiedViewListBox" ].Text)
1123
+
1079
1124
local currentConfig := AutoclickerGui.Submit(false )
1080
1125
1081
1126
local buttonClickData := { 1 : " L" , 2 : " R" , 3 : " M" }.%currentConfig.General_MouseButton_Radio%
@@ -1232,7 +1277,7 @@ Your current version is {}. Would you like to update now?
1232
1277
}
1233
1278
}
1234
1279
1235
- setupOptionsMenu()
1280
+ RegCreateKey REG_KEY_PATH " \Profiles "
1236
1281
1237
1282
if A_Args.Length > 0 && A_Args[1 ] = " /profile" {
1238
1283
add_log(" Detected /profile switch" )
@@ -1250,6 +1295,9 @@ if A_Args.Length > 0 && A_Args[1] = "/profile" {
1250
1295
Close()
1251
1296
}
1252
1297
1298
+ refreshProfileSelectionLists()
1299
+ setupOptionsMenu()
1300
+
1253
1301
AutoclickerGui.Show(" x0" )
1254
1302
add_log(" Showed main GUI" )
1255
1303
0 commit comments