formatting, added reusable lib for update checks

This commit is contained in:
2024-05-09 15:36:35 -04:00
parent 8395c5c367
commit d7d3ce039f
3 changed files with 26 additions and 0 deletions

View File

@@ -153,6 +153,7 @@ DownloadLatestChromium(){
Process, Close, chromedriver.exe Process, Close, chromedriver.exe
sleep, 5000 ; wait 5 seconds before checking again sleep, 5000 ; wait 5 seconds before checking again
continue
} }
else, else,
break break

View File

@@ -137,6 +137,10 @@ CheckDirExistAndCreate(Path){
; -------------------------------/CheckDirExistAndCreate------------------------------- ; -------------------------------/CheckDirExistAndCreate-------------------------------
; Script Updates
; ------------------------------------------------
CheckIfUpdateAvailable(Filepath, CurrentVersion){ CheckIfUpdateAvailable(Filepath, CurrentVersion){
FileRead, ScriptUpdateContents, %Filepath% FileRead, ScriptUpdateContents, %Filepath%

21
Update-Functions.ahk Normal file
View File

@@ -0,0 +1,21 @@
; This #include needs to be at the bottom of the parent script
CheckForUpdates:
; The GUI buttons must have variable set to vUpdateAvailable and vChromeUpdateAvailable for button to get updated
; The following variables need to be set in the parent script
; GitReleasesAPIURL
; ChromeFilepath
Message = Checking for Updates
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
if(CheckForUpdates(GitReleasesAPIURL))
GuiControl,,UpdateAvailable, Uploader Update Available!
if(CheckForChromeUpdates(ChromeFilepath)){
GuiControl,,ChromeUpdateAvailable, Chrome Update Available!
ChromeUpdateAvailable := 1
}
Return