@@ -43,25 +43,28 @@ A newer version of EC Autoclicker ({}) is available.
43
43
Your current version is {}. Would you like to update now?
44
44
)" , verNumMatch.1, thisVersion), " Update" , " YesNo Icon ? 262144 "
45
45
) = " Yes" {
46
- local downloadFilePath := ""
47
- while ! downloadFilePath || FileExist (downloadFilePath)
48
- downloadFilePath := A_ScriptDir " \" SubStr (A_ScriptName , 1 , - 4 ) " -new-" Random (100000 , 999999 ) " .exe"
46
+ local downloadFileTargetName := " EC-Autoclicker" (A_Is64bitOS ? " _x64" : "" ) " .exe"
47
+
48
+ local downloadFileInitialPath
49
+ Loop
50
+ downloadFileInitialPath := A_ScriptDir " \" downloadFileTargetName " .new-" Random (100000 , 9999999 )
51
+ Until ! FileExist (downloadFileInitialPath)
49
52
50
53
add_log(" Downloading file" )
51
54
52
55
try
53
- Download " https://github.com/" GITHUB_REPO " /releases/latest/download/EC-Autoclicker.exe "
54
- , downloadFilePath
56
+ Download " https://github.com/" GITHUB_REPO " /releases/latest/download/" downloadFileTargetName
57
+ , downloadFileInitialPath
55
58
catch as err
56
59
MsgBox " An error occurred in attempting to download the latest version of EC Autoclicker.`n`nMessage: " err.Message
57
60
, " Update"
58
61
, " Iconx 262144"
59
62
else {
60
63
add_log(" File downloaded" )
61
64
Run " powershell.exe -WindowStyle Hidden -Command Start-Sleep -Seconds 1;"
62
- . ' Remove- Item - LiteralPath " ' A_ScriptFullPath ' " ;'
63
- . ' Rename - Item - LiteralPath " ' downloadFilePath ' " - NewName " ' A_ScriptName ' " ;'
64
- . ' Start- Process - FilePath " ' A_ScriptDir '\EC-Autoclicker.exe /updated" '
65
+ . " Remove-Item -LiteralPath ' " A_ScriptFullPath " '; "
66
+ . " Rename-Item -LiteralPath ' " downloadFileInitialPath " ' -NewName ' " downloadFileTargetName " '; "
67
+ . " Start-Process -FilePath ' " A_ScriptDir " \ " downloadFileTargetName " ' -ArgumentList ' /updated' "
65
68
, , " Hide"
66
69
ExitApp
67
70
}
0 commit comments