improved chrome update functionality
This commit is contained in:
@@ -21,6 +21,9 @@ global InstalledChromeVersion
|
||||
; Chrome Related Functions
|
||||
;------------------------------------------------
|
||||
DownloadLatestChromium(){
|
||||
Message = Checking Variables for Downloading Newest Chrome
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
|
||||
if(ChromeFilepath = "")
|
||||
ChromeFilepath := GetInstalledChromeFilepath()
|
||||
|
||||
@@ -90,9 +93,9 @@ DownloadLatestChromium(){
|
||||
|
||||
|
||||
; close any open instances of Chromium
|
||||
SetTitleMatchMode, 2 ; substring
|
||||
|
||||
; SetTitleMatchMode, 2 ; substring
|
||||
|
||||
/*
|
||||
if(WinExist(" - Chromium")){
|
||||
Message = Trying to close any open Chromium Windows
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
@@ -111,19 +114,64 @@ DownloadLatestChromium(){
|
||||
MsgBox 0x10,, %Message%
|
||||
return
|
||||
}
|
||||
*/
|
||||
|
||||
; make sure all instances of chrome are closed
|
||||
Loop, {
|
||||
ChromeOpen := WinExist("ahk_exe chrome.exe")
|
||||
if(ChromeOpen) {
|
||||
Message = Chrome is Open. Asking user to close instances before continuing.
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
|
||||
MsgBox 0x41, Chrome is Open, Please close all instances of Chrome and then click OK to continue with replacing Chrome with the newest version.
|
||||
|
||||
IfMsgBox OK, {
|
||||
|
||||
} Else IfMsgBox Cancel, {
|
||||
return
|
||||
}
|
||||
|
||||
}
|
||||
else,
|
||||
break
|
||||
}
|
||||
|
||||
|
||||
; msgbox
|
||||
|
||||
; make sure all instances of chromedriver.exe are closed
|
||||
Message = Checking and killing any instances of the chromedriver.exe process
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
|
||||
Loop, 5 {
|
||||
|
||||
Process, Exist, chromedriver.exe
|
||||
ChromedriverExists := ErrorLevel
|
||||
|
||||
if(ChromedriverExists){
|
||||
Message = Chromedriver Exists on check number %A_Index%
|
||||
SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
|
||||
Process, Close, chromedriver.exe
|
||||
sleep, 5000 ; wait 5 seconds before checking again
|
||||
}
|
||||
else,
|
||||
break
|
||||
|
||||
Message = Chrome Update Failed. Unable to kill background chromedriver.exe process
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||
return
|
||||
|
||||
}
|
||||
|
||||
FileGetTime, ChromeDriverExeOldCreationTime, %ChromeDriverProgramFilesExeFilepath%, C
|
||||
|
||||
|
||||
|
||||
Message = Downloading Chromedriver v%ChromeStableLatestVersion% to:`n%ChromeDriverDownloadZipFilepath%
|
||||
Message = Downloading Chromedriver v%ChromeStableLatestVersion% `nFrom: %chromedriverDLURL64%`nTo: %ChromeDriverDownloadZipFilepath%
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
UrlDownloadToFile, %chromedriverDLURL64%, %ChromeDriverDownloadZipFilepath%
|
||||
|
||||
Message = Downloading Chromium v%ChromeStableLatestVersion% to:`n%ChromeDownloadZipFilepath%
|
||||
Message = Downloading Chromium v%ChromeStableLatestVersion% `nfrom: %chromeDLURL64% to:`n%ChromeDownloadZipFilepath%`n(This might take 1-2 minutes)
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
UrlDownloadToFile, %chromeDLURL64%, %ChromeDownloadZipFilepath%
|
||||
|
||||
@@ -132,6 +180,8 @@ DownloadLatestChromium(){
|
||||
Message = Deleting Old Chromium Directory
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
|
||||
|
||||
|
||||
FileRemoveDir, %ChromeExtractedDirectory%, 1
|
||||
if(FileExist(ChromeExtractedDirectory)){
|
||||
Message = Failed to delete the old Chromium. `nPlease manually delete the following directory and then run the Chrome Update again.`n`n %ChromeExtractedDirectory%
|
||||
|
||||
Reference in New Issue
Block a user