Compare commits
1 Commits
5671242faf
...
b8ffb10db1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b8ffb10db1 |
@@ -21,6 +21,9 @@ global InstalledChromeVersion
|
|||||||
; Chrome Related Functions
|
; Chrome Related Functions
|
||||||
;------------------------------------------------
|
;------------------------------------------------
|
||||||
DownloadLatestChromium(){
|
DownloadLatestChromium(){
|
||||||
|
Message = Checking Variables for Downloading Newest Chrome
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
|
||||||
if(ChromeFilepath = "")
|
if(ChromeFilepath = "")
|
||||||
ChromeFilepath := GetInstalledChromeFilepath()
|
ChromeFilepath := GetInstalledChromeFilepath()
|
||||||
|
|
||||||
@@ -90,9 +93,9 @@ DownloadLatestChromium(){
|
|||||||
|
|
||||||
|
|
||||||
; close any open instances of Chromium
|
; close any open instances of Chromium
|
||||||
SetTitleMatchMode, 2 ; substring
|
; SetTitleMatchMode, 2 ; substring
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
if(WinExist(" - Chromium")){
|
if(WinExist(" - Chromium")){
|
||||||
Message = Trying to close any open Chromium Windows
|
Message = Trying to close any open Chromium Windows
|
||||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
@@ -111,19 +114,64 @@ DownloadLatestChromium(){
|
|||||||
MsgBox 0x10,, %Message%
|
MsgBox 0x10,, %Message%
|
||||||
return
|
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
|
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")
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
UrlDownloadToFile, %chromedriverDLURL64%, %ChromeDriverDownloadZipFilepath%
|
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")
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
UrlDownloadToFile, %chromeDLURL64%, %ChromeDownloadZipFilepath%
|
UrlDownloadToFile, %chromeDLURL64%, %ChromeDownloadZipFilepath%
|
||||||
|
|
||||||
@@ -132,6 +180,8 @@ DownloadLatestChromium(){
|
|||||||
Message = Deleting Old Chromium Directory
|
Message = Deleting Old Chromium Directory
|
||||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
FileRemoveDir, %ChromeExtractedDirectory%, 1
|
FileRemoveDir, %ChromeExtractedDirectory%, 1
|
||||||
if(FileExist(ChromeExtractedDirectory)){
|
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%
|
Message = Failed to delete the old Chromium. `nPlease manually delete the following directory and then run the Chrome Update again.`n`n %ChromeExtractedDirectory%
|
||||||
@@ -261,11 +311,11 @@ DownloadLatestChromium(){
|
|||||||
|
|
||||||
ToolTip
|
ToolTip
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CheckForChromeUpdates(ChromeFilepath := ""){
|
CheckForChromeUpdates(ChromeFilepath := ""){
|
||||||
if(ChromeFilepath = "")
|
if(ChromeFilepath = "")
|
||||||
ChromeFilepath := GetInstalledChromeFilepath()
|
ChromeFilepath := GetInstalledChromeFilepath()
|
||||||
|
|
||||||
@@ -279,10 +329,10 @@ CheckForChromeUpdates(ChromeFilepath := ""){
|
|||||||
else, Return 0
|
else, Return 0
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GetInstalledChromeFilepath(){
|
GetInstalledChromeFilepath(){
|
||||||
; ChromeFilepath is global variable
|
; ChromeFilepath is global variable
|
||||||
|
|
||||||
if(ChromeFilepath = ""){
|
if(ChromeFilepath = ""){
|
||||||
@@ -314,9 +364,9 @@ GetInstalledChromeFilepath(){
|
|||||||
}
|
}
|
||||||
ToolTip
|
ToolTip
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GetInstalledChromeVersion(){
|
GetInstalledChromeVersion(){
|
||||||
|
|
||||||
if(ChromeFilepath = ""){
|
if(ChromeFilepath = ""){
|
||||||
GetInstalledChromeFilepath()
|
GetInstalledChromeFilepath()
|
||||||
@@ -329,10 +379,10 @@ GetInstalledChromeVersion(){
|
|||||||
InstalledChromeVersion := StrReplace(InstalledChromeVersion, "`r") ; replace any newline characters that powershell returns
|
InstalledChromeVersion := StrReplace(InstalledChromeVersion, "`r") ; replace any newline characters that powershell returns
|
||||||
|
|
||||||
return InstalledChromeVersion
|
return InstalledChromeVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GetLatestChromeStableVersion(){
|
GetLatestChromeStableVersion(){
|
||||||
|
|
||||||
; https://github.com/GoogleChromeLabs/chrome-for-testing#json-api-endpoints
|
; https://github.com/GoogleChromeLabs/chrome-for-testing#json-api-endpoints
|
||||||
json_str := urldownloadtovar("https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions.json")
|
json_str := urldownloadtovar("https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions.json")
|
||||||
@@ -349,10 +399,10 @@ GetLatestChromeStableVersion(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
return ChromeStableLatestVersion
|
return ChromeStableLatestVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GetDownloadURLOfChromeAndDriver(InstalledChromeVersion){
|
GetDownloadURLOfChromeAndDriver(InstalledChromeVersion){
|
||||||
; Will return the download URL of Chrome for Testing and Chrome Driver, seperated by a ||
|
; Will return the download URL of Chrome for Testing and Chrome Driver, seperated by a ||
|
||||||
|
|
||||||
; https://github.com/GoogleChromeLabs/chrome-for-testing#json-api-endpoints
|
; https://github.com/GoogleChromeLabs/chrome-for-testing#json-api-endpoints
|
||||||
@@ -399,4 +449,4 @@ GetDownloadURLOfChromeAndDriver(InstalledChromeVersion){
|
|||||||
|
|
||||||
URLS = %chromeDLURL64%||%chromedriverDLURL64%
|
URLS = %chromeDLURL64%||%chromedriverDLURL64%
|
||||||
return URLS
|
return URLS
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user