From 534df945ebe6dca2db31dbdd54919e40c24c46f9 Mon Sep 17 00:00:00 2001 From: yuriy Date: Sat, 16 Sep 2023 22:45:52 -0400 Subject: [PATCH] added update check for chrome during startup if update checkox is checked --- Freedomain Video Uploader.ahk | 93 ++++++++++++++----------- Lib/Freedomain-Posters-Shared-Functions | 2 +- 2 files changed, 54 insertions(+), 41 deletions(-) diff --git a/Freedomain Video Uploader.ahk b/Freedomain Video Uploader.ahk index 4dd6d8c..0e62085 100644 --- a/Freedomain Video Uploader.ahk +++ b/Freedomain Video Uploader.ahk @@ -584,41 +584,6 @@ else, { } - - -;---Check for Update--- -;------------------------------------------------ -if(AutoUpdateCheck AND !UpdateAvailable){ - ; DevModeMsgBox("checking for updates") - ; msgbox, checkin for update - ; DevModeMsgBox(GitReleasesAPIURL) - UpdateAvailable := CheckForUpdates(GitReleasesAPIURL) -} - - -; Initiate Chrome Filepath Variable -; @todo: find a better location for this? -GetChromeFilepath() - - -; Msgbox % "ChromeFIlepath: " ChromeFIlepath - -if(!InStr(ChromeFilepath, A_scriptDir)){ - ; Chrome portale is not downloaded. Ask user to download it. - msgbox, download newest portable chrome? - LatestVersion := GetLatestChromeStableVersion() - Msgbox % "LatestVersion: " LatestVersion - DownloadURLs := GetDownloadURLOfChromeAndDriver(LatestVersion) - Msgbox % "DownloadURLs: " DownloadURLs - Msgbox % "chromedriverDLURL64: " chromedriverDLURL64 - Msgbox % "chromeDLURL64: " chromeDLURL64 -} - - -; DevModeMsgBox(AutoUpdateCheck) -; DevModeMsgBox(UpdateAvailable) - - ; -------------------------------GUI------------------------------- Gui, Font, s%GuiFontSize% @@ -731,7 +696,7 @@ if(UpdateAvailable){ ; GuiButtonIcon(Icon, "shell32.dll", 278, "s20 a1 r2") } else, { - Gui, Add, Button, w%EditBoxHalfWidths% x%MarginSpace% gUpdateScript vUpdateAvailable h%SecondaryButtonHeights% center,Program Up-to-Date + Gui, Add, Button, w%EditBoxHalfWidths% x%MarginSpace% gUpdateScript vUpdateAvailable h%SecondaryButtonHeights% center,Uploader Up-to-Date ; Gui, Add, Button, w%EditBoxHalfWidths% x+%Marginspace% vUpdateAvailable hwndIcon, Script is Up-to-Date ; GuiButtonIcon(Icon, "shell32.dll", 239, "s20 a1 r2") @@ -744,12 +709,11 @@ Gui, Add, Button, x+%MarginSpace% w%EditBoxHalfWidths% h%SecondaryButtonHeights% Gui, Font, s%GuiFontSize% ; Chrome Update Button -ChromeUpdateAvailable := 1 if(ChromeUpdateAvailable){ - Gui, Add, Button, x%MarginSpace% w%EditBoxHalfWidths% y+%Marginspace% h%SecondaryButtonHeights% gUpdateChrome center,Chrome Update Available + Gui, Add, Button, x%MarginSpace% w%EditBoxHalfWidths% y+%Marginspace% h%SecondaryButtonHeights% vChromeUpdateAvailable gUpdateChrome center,Chrome Update Available } else, { - Gui, Add, Button, x%MarginSpace% w%EditBoxHalfWidths% y+%Marginspace% h%SecondaryButtonHeights% gUpdateChrome center,Chrome Up-to-Date + Gui, Add, Button, x%MarginSpace% w%EditBoxHalfWidths% y+%Marginspace% h%SecondaryButtonHeights% vChromeUpdateAvailable gUpdateChrome center,Chrome Up-to-Date } ; Gui, Add, Button, x%MarginSpace% w%EditBoxHalfWidths% y+25 h%MainButtonHeight% gCancelPost hwndIcon, Exit @@ -866,7 +830,6 @@ if(SkipToDBInfo){ goto, DisplayResults } - ; Write current project to ini file for easy reloading IniWrite, %BodyTextFilePath%, %SettingsIniFilepath%, %ScriptSettingsSection%, LastPost @@ -875,6 +838,56 @@ IniWrite, %BodyTextFilePath%, %SettingsIniFilepath%, %ScriptSettingsSection%, La ; Msgbox % "URunTime: " URunTime +;---Check for Update--- +;------------------------------------------------ +; msgbox, checking for updates +if(AutoUpdateCheck AND !UpdateAvailable){ + Message = Checking for Updates + SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") + ; DevModeMsgBox("checking for updates") + ; msgbox, checkin for update + ; DevModeMsgBox(GitReleasesAPIURL) + ; UpdateAvailable := + + if(CheckForUpdates(GitReleasesAPIURL)) + GuiControl ,, UpdateAvailable, Uploader Update Available + + if(CheckForChromeUpdates(ChromeFilepath)) + GuiControl ,, ChromeUpdateAvailable, Chrome Update Available + + ; GetChromeFilepath() +} +; msgbox, done! +; msgbox, checking update +; msgbox % +; msgbox + +; if() +; Initiate Chrome Filepath Variable +; @todo: find a better location for this? + +; GetChromeFilepath() + +; Msgbox % "ChromeFIlepath: " ChromeFIlepath +/* +if(!InStr(ChromeFilepath, A_scriptDir)){ + ; Chrome portale is not downloaded. Ask user to download it. + msgbox, download newest portable chrome? + LatestVersion := GetLatestChromeStableVersion() + Msgbox % "LatestVersion: " LatestVersion + DownloadURLs := GetDownloadURLOfChromeAndDriver(LatestVersion) + Msgbox % "DownloadURLs: " DownloadURLs + Msgbox % "chromedriverDLURL64: " chromedriverDLURL64 + Msgbox % "chromeDLURL64: " chromeDLURL64 +} + +*/ + +; DevModeMsgBox(AutoUpdateCheck) +; DevModeMsgBox(UpdateAvailable) + + + Return ; -------------------------------GUI GoSubs------------------------------- diff --git a/Lib/Freedomain-Posters-Shared-Functions b/Lib/Freedomain-Posters-Shared-Functions index 74e67e5..7106ed5 160000 --- a/Lib/Freedomain-Posters-Shared-Functions +++ b/Lib/Freedomain-Posters-Shared-Functions @@ -1 +1 @@ -Subproject commit 74e67e5ab9c21511e42290cfac3dbb837cea5c32 +Subproject commit 7106ed522fb1f94d2635abe9147bb26c7ebcde85