From d7d3ce039f804158b286a9499109ee0c179cd422 Mon Sep 17 00:00:00 2001 From: Yuriy Date: Thu, 9 May 2024 15:36:35 -0400 Subject: [PATCH] formatting, added reusable lib for update checks --- Chrome-Functions.ahk | 1 + General-Functions.ahk | 4 ++++ Update-Functions.ahk | 21 +++++++++++++++++++++ 3 files changed, 26 insertions(+) create mode 100644 Update-Functions.ahk diff --git a/Chrome-Functions.ahk b/Chrome-Functions.ahk index f3d417f..5a19ce7 100644 --- a/Chrome-Functions.ahk +++ b/Chrome-Functions.ahk @@ -153,6 +153,7 @@ DownloadLatestChromium(){ Process, Close, chromedriver.exe sleep, 5000 ; wait 5 seconds before checking again + continue } else, break diff --git a/General-Functions.ahk b/General-Functions.ahk index 835f6f2..09b7913 100644 --- a/General-Functions.ahk +++ b/General-Functions.ahk @@ -137,6 +137,10 @@ CheckDirExistAndCreate(Path){ ; -------------------------------/CheckDirExistAndCreate------------------------------- +; Script Updates +; ------------------------------------------------ + + CheckIfUpdateAvailable(Filepath, CurrentVersion){ FileRead, ScriptUpdateContents, %Filepath% diff --git a/Update-Functions.ahk b/Update-Functions.ahk new file mode 100644 index 0000000..f4a3069 --- /dev/null +++ b/Update-Functions.ahk @@ -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 \ No newline at end of file