|
5 | 5 |
|
6 | 6 | ;@Ahk2Exe-SetCompanyName Expertcoderz
|
7 | 7 | ;@Ahk2Exe-SetDescription EC Autoclicker
|
8 |
| -;@Ahk2Exe-SetVersion 1.1.2 |
| 8 | +;@Ahk2Exe-SetVersion 1.1.3 |
9 | 9 |
|
10 | 10 | FILE_EXT := ".ac-profile"
|
11 | 11 | REG_KEY_PATH := "HKCU\Software\Expertcoderz\Autoclicker"
|
@@ -155,7 +155,7 @@ HelpMenu.Add SZ_TABLE.Menu_Help_OnlineHelp
|
155 | 155 | HelpMenu.Add SZ_TABLE.Menu_Help_Report
|
156 | 156 | , (*) => Run("https://github.com/Expertcoderz/EC-Autoclicker/issues/new/choose")
|
157 | 157 | HelpMenu.Add SZ_TABLE.Menu_Help_Update
|
158 |
| - , (*) => CheckForNewerVersion(true) |
| 158 | + , (*) => CheckForUpdates(true) |
159 | 159 | if !A_IsCompiled
|
160 | 160 | HelpMenu.Disable SZ_TABLE.Menu_Help_Update
|
161 | 161 | HelpMenu.Add
|
@@ -320,7 +320,6 @@ add_log(text) {
|
320 | 320 | showGuiAtAutoclickerGuiPos(gui) {
|
321 | 321 | local posX, posY
|
322 | 322 | AutoclickerGui.GetPos &posX, &posY
|
323 |
| - global always_on_top |
324 | 323 | gui.Opt (always_on_top ? "+" : "-") "AlwaysOnTop"
|
325 | 324 | gui.Show "x" posX " y" posY
|
326 | 325 | }
|
@@ -521,7 +520,7 @@ Hotkeys_ClearAllHotkeys(*) {
|
521 | 520 | Hotkeys_updateHotkeyBindings
|
522 | 521 | }
|
523 | 522 |
|
524 |
| -profileNamePrompt(title, text, callback) { |
| 523 | +profileNamePrompt(title, text, callback, owner := AutoclickerGui) { |
525 | 524 | static currentCallback
|
526 | 525 | static ProfileNamePromptGui
|
527 | 526 | if !IsSet(ProfileNamePromptGui) {
|
@@ -570,12 +569,18 @@ profileNamePrompt(title, text, callback) {
|
570 | 569 | ProfileNamePromptGui["PromptText"].Text := text
|
571 | 570 | ProfileNamePromptGui["ProfileNameEdit"].Value := ""
|
572 | 571 | ProfileNamePromptGui.Opt "-Disabled"
|
573 |
| - showGuiAtAutoclickerGuiPos ProfileNamePromptGui |
| 572 | + owner.Opt "+Disabled" |
| 573 | + if owner = AutoclickerGui |
| 574 | + showGuiAtAutoclickerGuiPos ProfileNamePromptGui |
| 575 | + else { |
| 576 | + local posX, posY |
| 577 | + owner.GetPos &posX, &posY |
| 578 | + ProfileNamePromptGui.Opt (always_on_top ? "+" : "-") "AlwaysOnTop" |
| 579 | + ProfileNamePromptGui.Show "x" posX " y" posY |
| 580 | + } |
574 | 581 | }
|
575 | 582 |
|
576 | 583 | ProfileCreate(*) {
|
577 |
| - AutoclickerGui.Opt "+Disabled" |
578 |
| - |
579 | 584 | profileNamePrompt "Create/Update Profile"
|
580 | 585 | , "The current autoclicker configuration will`nbe saved with the following profile name:"
|
581 | 586 | , SubmitPrompt
|
@@ -658,10 +663,11 @@ ProfileManage(*) {
|
658 | 663 |
|
659 | 664 | ProfileRename(*) {
|
660 | 665 | local selectedProfileName := ProfilesGui["ProfileList"].GetText(ProfilesGui["ProfileList"].GetNext())
|
661 |
| - profileNamePrompt("Rename Profile" |
| 666 | + |
| 667 | + profileNamePrompt "Rename Profile" |
662 | 668 | , "The profile '" selectedProfileName "' will be renamed to:"
|
663 | 669 | , SubmitPrompt
|
664 |
| - ) |
| 670 | + |
665 | 671 | SubmitPrompt(newProfileName) {
|
666 | 672 | Loop Reg REG_KEY_PATH "\Profiles", "K" {
|
667 | 673 | if A_LoopRegName = selectedProfileName {
|
@@ -739,20 +745,32 @@ ProfileManage(*) {
|
739 | 745 |
|
740 | 746 | RegCreateKey REG_KEY_PATH "\Profiles\" profileName
|
741 | 747 |
|
742 |
| - Loop Parse FileRead(fileLocation), "`n" { |
743 |
| - if !A_LoopField |
744 |
| - continue |
745 |
| - local configMatch |
746 |
| - RegExMatch A_LoopField, "^(?P<Name>\w+?)=(?P<Value>.+)$", &configMatch |
747 |
| - add_log "Read: " configMatch["Name"] " = " configMatch["Value"] |
748 |
| - if configMatch["Name"] = "Hotkeys" |
749 |
| - RegWrite StrReplace(configMatch["Value"], "`t", "`n"), "REG_MULTI_SZ" |
750 |
| - , REG_KEY_PATH "\Profiles\" profileName, "Hotkeys" |
751 |
| - else |
752 |
| - RegWrite configMatch["Value"], configMatch["Name"] ~= "DateTime" ? "REG_SZ" : "REG_DWORD" |
753 |
| - , REG_KEY_PATH "\Profiles\" profileName, configMatch["Name"] |
| 748 | + local e |
| 749 | + try { |
| 750 | + Loop Parse FileRead(fileLocation), "`n" { |
| 751 | + if !A_LoopField |
| 752 | + continue |
| 753 | + local configMatch |
| 754 | + RegExMatch A_LoopField, "^(?P<Name>\w+?)=(?P<Value>.+)$", &configMatch |
| 755 | + add_log "Read: " configMatch["Name"] " = " configMatch["Value"] |
| 756 | + if configMatch["Name"] = "Hotkeys" |
| 757 | + RegWrite StrReplace(configMatch["Value"], "`t", "`n"), "REG_MULTI_SZ" |
| 758 | + , REG_KEY_PATH "\Profiles\" profileName, "Hotkeys" |
| 759 | + else |
| 760 | + RegWrite configMatch["Value"], configMatch["Name"] ~= "DateTime" ? "REG_SZ" : "REG_DWORD" |
| 761 | + , REG_KEY_PATH "\Profiles\" profileName, configMatch["Name"] |
| 762 | + } |
| 763 | + } catch as e { |
| 764 | + add_log "Import Profile error: " e.Message |
| 765 | + MsgBox Format(" |
| 766 | + ( |
| 767 | +An error occurred whilst importing the profile '{}' from {}. |
| 768 | +This is likely due to corrupt data. |
| 769 | + |
| 770 | +Message: {} |
| 771 | +)", profileName, fileLocation, e.Message), "Import Profile", "Iconx 8192" |
| 772 | + return |
754 | 773 | }
|
755 |
| - |
756 | 774 | refreshProfileList profileName
|
757 | 775 |
|
758 | 776 | add_log "Finished importing profile '" profileName "'"
|
@@ -810,9 +828,16 @@ ProfileLoad(profileName, *) {
|
810 | 828 | }
|
811 | 829 | }
|
812 | 830 | add_log "Configuration GUI updated from profile"
|
813 |
| - } catch as e |
814 |
| - MsgBox "An error occurred whilst loading the profile '" profileName "'. This is likely due to corrupt data.`n`nMessage: " e.Message |
815 |
| - , "Load Profile", "Iconx 8192" |
| 831 | + } catch as e { |
| 832 | + add_log "Load Profile error: " e.Message |
| 833 | + MsgBox Format(" |
| 834 | + ( |
| 835 | +An error occurred whilst loading the profile '{}'. |
| 836 | +This is likely due to corrupt data. |
| 837 | + |
| 838 | +Message: {} |
| 839 | +)", profileName, e.Message), "Load Profile", "Iconx 8192" |
| 840 | + } |
816 | 841 | return
|
817 | 842 | }
|
818 | 843 | }
|
@@ -1016,8 +1041,18 @@ Close(*) {
|
1016 | 1041 | ExitApp
|
1017 | 1042 | }
|
1018 | 1043 |
|
1019 |
| -CheckForNewerVersion(isManual) { |
1020 |
| - add_log "Checking for newer version" |
| 1044 | +CheckForUpdates(isManual) { |
| 1045 | + if !DllCall("Wininet.dll\InternetGetConnectedState", "Str", "0x40", "Int", 0) { |
| 1046 | + add_log "No internet connection; not checking for updates" |
| 1047 | + if isManual |
| 1048 | + MsgBox " |
| 1049 | + ( |
| 1050 | +EC Autoclicker is unable to check for updates as there is currently no internet connection. |
| 1051 | +Please connect to the internet and try again. |
| 1052 | +)", "Update", "Icon! 262144" |
| 1053 | + return |
| 1054 | + } |
| 1055 | + add_log "Checking for updates" |
1021 | 1056 |
|
1022 | 1057 | local oHttp := ComObject("WinHttp.Winhttprequest.5.1")
|
1023 | 1058 | oHttp.open "GET", "https://api.github.com/repos/Expertcoderz/EC-Autoclicker/releases/latest"
|
@@ -1092,7 +1127,7 @@ if A_IsCompiled {
|
1092 | 1127 | , "Update", "Iconi 262144"
|
1093 | 1128 | } else if RegRead(REG_KEY_PATH, "AutoUpdate", true) && A_NowUTC - RegRead(REG_KEY_PATH, "LastUpdateCheck", 0) >= 604800 {
|
1094 | 1129 | add_log "Automatically checking for newer version"
|
1095 |
| - CheckForNewerVersion false |
| 1130 | + CheckForUpdates false |
1096 | 1131 | }
|
1097 | 1132 | }
|
1098 | 1133 |
|
|
0 commit comments