Skip to content

Commit 83fc8b3

Browse files
committed
Minor cleanup regarding constants and PowerShell code formatting
1 parent 9d8e5b3 commit 83fc8b3

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

EC-Autoclicker.ahk

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
;@Ahk2Exe-SetDescription EC Autoclicker
88
;@Ahk2Exe-SetVersion 1.1.5
99

10+
GITHUB_REPO := "Expertcoderz/EC-Autoclicker"
11+
1012
FILE_EXT := ".ac-profile"
1113
REG_KEY_PATH := "HKCU\Software\Expertcoderz\Autoclicker"
1214
RegCreateKey REG_KEY_PATH "\Profiles"
@@ -154,9 +156,9 @@ PersistentOptions := [
154156

155157
HelpMenu := Menu()
156158
HelpMenu.Add SZ_TABLE.Menu_Help_OnlineHelp
157-
, (*) => Run("https://github.com/Expertcoderz/EC-Autoclicker#readme")
159+
, (*) => Run("https://github.com/" GITHUB_REPO "#readme")
158160
HelpMenu.Add SZ_TABLE.Menu_Help_Report
159-
, (*) => Run("https://github.com/Expertcoderz/EC-Autoclicker/issues/new/choose")
161+
, (*) => Run("https://github.com/" GITHUB_REPO "/issues/new/choose")
160162
HelpMenu.Add SZ_TABLE.Menu_Help_Update
161163
, (*) => CheckForUpdates(true)
162164
if !A_IsCompiled
@@ -749,7 +751,7 @@ ProfileManage(*) {
749751

750752
ProfileImport(*) {
751753
local fileLocations := FileSelect("M",
752-
, "Import Autoclicker Profile(s)", "Autoclicker Profiles (*.ac-profile)"
754+
, "Import Autoclicker Profile(s)", "Autoclicker Profiles (*" FILE_EXT ")"
753755
)
754756
local fileLocation
755757
for fileLocation in fileLocations {
@@ -975,7 +977,7 @@ AboutOpen(*) {
975977
AboutGui.AddText "xp+50 yp", "EC Autoclicker version " (A_IsCompiled ? SubStr(FileGetVersion(A_ScriptFullPath), 1, -2) : "?")
976978
AboutGui.SetFont
977979
AboutGui.AddText "xp wp", "An open-source configurable autoclicking utility for Windows."
978-
AboutGui.AddLink "xp", "<a href=`"https://github.com/Expertcoderz/EC-Autoclicker`">https://github.com/Expertcoderz/EC-Autoclicker</a>"
980+
AboutGui.AddLink "xp", '<a href="https://github.com/' GITHUB_REPO '">https://github.com/' GITHUB_REPO "</a>"
979981

980982
add_log "Created About GUI"
981983
}
@@ -1087,7 +1089,7 @@ Please connect to the internet and try again.
10871089
add_log "Checking for updates"
10881090

10891091
local oHttp := ComObject("WinHttp.Winhttprequest.5.1")
1090-
oHttp.open "GET", "https://api.github.com/repos/Expertcoderz/EC-Autoclicker/releases/latest"
1092+
oHttp.open "GET", "https://api.github.com/repos/" GITHUB_REPO "/releases/latest"
10911093
oHttp.send
10921094

10931095
local verNumMatch
@@ -1122,17 +1124,18 @@ Your current version is {}. Would you like to update now?
11221124

11231125
add_log "Downloading file"
11241126

1125-
try Download "https://github.com/Expertcoderz/EC-Autoclicker/releases/latest/download/EC-Autoclicker.exe"
1127+
try Download "https://github.com/" GITHUB_REPO "/releases/latest/download/EC-Autoclicker.exe"
11261128
, downloadFilePath
11271129
catch as e
11281130
MsgBox "An error occurred in attempting to download the latest version of EC Autoclicker.`n`nMessage: " e.Message
11291131
, "Update", "Iconx 262144"
11301132
else {
11311133
add_log("File downloaded")
1132-
Run "powershell -windowstyle Hidden -command start-sleep 1;"
1133-
. 'remove-item "' A_ScriptFullPath '";'
1134-
. 'rename-item "' downloadFilePath '" "' A_ScriptName '";'
1135-
. 'start-process "' A_ScriptDir '\EC-Autoclicker.exe /updated"', , "Hide"
1134+
Run "powershell.exe -WindowStyle Hidden -Command Start-Sleep -Seconds 1;"
1135+
. 'Remove-Item -LiteralPath "' A_ScriptFullPath '";'
1136+
. 'Rename-Item -LiteralPath "' downloadFilePath '" -NewName "' A_ScriptName '";'
1137+
. 'Start-Process -FilePath "' A_ScriptDir '\EC-Autoclicker.exe /updated"'
1138+
, , "Hide"
11361139
ExitApp
11371140
}
11381141
}

0 commit comments

Comments
 (0)