Compare commits

..

6 Commits

Author SHA1 Message Date
1e77871bd8 updated docs url 2023-12-11 13:27:57 -05:00
Yuriy
57e132fafd updated links to freedomain.dev 2023-12-11 13:20:38 -05:00
71b950c57f removed logging to text file due to causing selenium error bug for unknown reason 2023-11-03 22:42:43 -04:00
cf82847058 Fixed errors when gitea not available 2023-10-22 02:22:08 -04:00
cfce669061 chrome updater bug fixes 2023-10-22 01:19:49 -04:00
0b9b63b715 fixed chrome/chromedriver downloading 2023-10-22 00:28:38 -04:00
5 changed files with 86 additions and 21 deletions

View File

@@ -37,10 +37,10 @@ DownloadLatestChromium(){
ChromeDriverDownloadFilepath = %ParentFolder%\chromedriver-win64 ChromeDriverDownloadFilepath = %ParentFolder%\chromedriver-win64
ChromeDriverTemporaryExeFilepath = %ParentFolder%\chromedriver-win64\chromedriver-win64\chromedriver.exe ChromeDriverTemporaryExeFilepath = %ParentFolder%\chromedriver-win64\chromedriver-win64\chromedriver.exe
ChromeDownloadZipFilepath = %ParentFolder%\chrome-win64.zip ChromeDownloadZipFilepath = %ParentFolder%\chrome-win64.zip
ChromeDownloadFilepath = C:\Users\%A_Username%\Syncthing\Git\Freedomain-Video-Uploader\Lib\chrome-win64 ChromeExtractedDirectory = %A_ScriptDir%\Lib\chrome-win64
ChromeDriverMoverEXEFilepath = %A_ScriptDir%\Lib\Chromedriver-Mover.exe ChromeDriverMoverEXEFilepath = %A_ScriptDir%\Lib\Chromedriver-Mover.exe
ChromeDriverMoverURL = https://git.freedomainplaylists.com/yuriy/Chromedriver-Mover/releases/download/1.0/Chromedriver-Mover.exe ChromeDriverMoverURL = https://git.freedomainplaylists.com/yuriy/Chromedriver-Mover/releases/download/1.1/Chromedriver-Mover.exe
ChromeDriverProgramFilesExeFilepath = C:\Program Files\SeleniumBasic\chromedriver.exe ChromeDriverProgramFilesExeFilepath = C:\Program Files\SeleniumBasic\chromedriver.exe
@@ -79,7 +79,7 @@ DownloadLatestChromium(){
FileRemoveDir, %ChromeDriverDownloadFilepath%, 1 FileRemoveDir, %ChromeDriverDownloadFilepath%, 1
msgbox, failed to delete %ChromeDriverDownloadFilepath% msgbox, failed to delete %ChromeDriverDownloadFilepath%
FileRemoveDir, %ChromeDownloadFilepath%, 1 FileRemoveDir, %ChromeExtractedDirectory%, 1
*/ */
@@ -89,16 +89,41 @@ DownloadLatestChromium(){
} }
; close any open instances of Chromium
SetTitleMatchMode, 2 ; substring
if(WinExist(" - Chromium")){
Message = Trying to close any open Chromium Windows
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Loop, 10 {
WinClose, - Chromium ; , WinText, SecondsToWait, ExcludeTitle, ExcludeText]
sleep, 500
}
}
if(WinExist(" - Chromium")){
Message = Failed to close existing Chromium Window(s). Please close them manually and then click the "Update Chrome" button again
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
ToolTip
MsgBox 0x10,, %Message%
return
}
; msgbox
FileGetTime, ChromeDriverExeOldCreationTime, %ChromeDriverProgramFilesExeFilepath%, C FileGetTime, ChromeDriverExeOldCreationTime, %ChromeDriverProgramFilesExeFilepath%, C
Message = Downloading Chromedriver v%ChromeStableLatestVersion% Message = Downloading Chromedriver v%ChromeStableLatestVersion% to:`n%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% Message = Downloading Chromium v%ChromeStableLatestVersion% to:`n%ChromeDownloadZipFilepath%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
UrlDownloadToFile, %chromeDLURL64%, %ChromeDownloadZipFilepath% UrlDownloadToFile, %chromeDLURL64%, %ChromeDownloadZipFilepath%
@@ -107,16 +132,36 @@ 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, %ChromeDownloadFilepath%, 1 FileRemoveDir, %ChromeExtractedDirectory%, 1
if(FileExist(ChromeDownloadFilepath)){ 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 %ChromeDownloadFilepath% Message = Failed to delete the old Chromium. `nPlease manually delete the following directory and then run the Chrome Update again.`n`n %ChromeExtractedDirectory%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar")
MsgBox 0x10,, %Message%
ToolTip ToolTip
return return
} }
; Double check that .zip files exist
ChromeDriverZipExists := FileExist(ChromeDriverDownloadZipFilepath)
if(!ChromeDriverZipExists){
Message = Download of chromedriver failed for some reason. chromedriver.zip not found.
SaveOrPostProgress(Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
MsgBox 0x10,, %Message%
Return
}
ChromeZipExists := FileExist(ChromeDownloadZipFilepath)
if(!ChromeZipExists){
Message = Download of chrome failed for some reason. chrome.zip not found.
SaveOrPostProgress(Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
MsgBox 0x10,, %Message%
Return
}
Message = Extracting Chromedriver v%ChromeStableLatestVersion% Zip file Message = Extracting Chromedriver v%ChromeStableLatestVersion% Zip file
@@ -125,13 +170,16 @@ DownloadLatestChromium(){
Message = Extracting Chromium v%ChromeStableLatestVersion% Zip file Message = Extracting Chromium v%ChromeStableLatestVersion% Zip file
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Unzip(ChromeDownloadZipFilepath, ChromeDownloadFilepath) Unzip(ChromeDownloadZipFilepath, ChromeExtractedDirectory)
; Check if the Copy-ChromeDriver-To-Program-Files.exe file exists ; Check if the Copy-ChromeDriver-To-Program-Files.exe file exists
; @todo, remove later. this is temporary to fix chromedriver-mover being broken and needing to be replaced
FileDelete, %ChromeDriverMoverEXEFilepath%
Message = Checking Chromedriver-Mover.exe exists Message = Checking Chromedriver-Mover.exe exists
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
@@ -172,7 +220,7 @@ DownloadLatestChromium(){
} }
Message = Waiting for new Chromedriver to get moved to C:\Program Files\SeleniumBasic\ Message = Waiting 30 seconds for new Chromedriver to get moved to C:\Program Files\SeleniumBasic\
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Loop, 30 { Loop, 30 {
@@ -250,7 +298,7 @@ GetInstalledChromeFilepath(){
ChromeFilepath := ChromePortableFilepath ChromeFilepath := ChromePortableFilepath
Message = Using Chromium Portable for Upload Message = Using Chromium Portable for Upload
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile,DiscordErrorLogging")
} }
else { else {
MsgBox 0x10, Chromium Portable not Found, Chromium Portable not found. `nPlease make sure it's located at one of the following paths and then try again.`n`n%ChromePortableFilepath% `nOR`n%ChromePortableFilepath2% MsgBox 0x10, Chromium Portable not Found, Chromium Portable not found. `nPlease make sure it's located at one of the following paths and then try again.`n`n%ChromePortableFilepath% `nOR`n%ChromePortableFilepath2%

View File

@@ -35,9 +35,10 @@ SaveOrPostProgress(Message:="",PostType:=""){
if(InStr(PostType, "Tooltip")){ if(InStr(PostType, "Tooltip")){
TooltipThis(Message) TooltipThis(Message)
} }
if(InStr(PostType, "ErrorLoggingTextFile")){ /* if(InStr(PostType, "ErrorLoggingTextFile")){
Func_LogErrorsToTextFile(Message) Func_LogErrorsToTextFile(Message)
} }
*/
if(InStr(PostType, "ErrorSummaryVar")){ if(InStr(PostType, "ErrorSummaryVar")){
Func_LogErrorsToVar(Message) Func_LogErrorsToVar(Message)
} }

View File

@@ -8,7 +8,12 @@ CheckForUpdates(GitReleasesAPIURL){
data := URLDownloadToVar(GitReleasesAPIURL) data := URLDownloadToVar(GitReleasesAPIURL)
; Msgbox % "data: " data ; Msgbox % "data: " data
parsed := JSON.Load(data) try, parsed := JSON.Load(data)
catch e {
Message = Failed to check for updates. Gitea Releases API returned blank or malformed data.
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Return
}
UpdateVersionNumber := parsed.1.name UpdateVersionNumber := parsed.1.name
@@ -17,10 +22,10 @@ CheckForUpdates(GitReleasesAPIURL){
if(ScriptVersion = UpdateVersionNumber OR ScriptVersion > UpdateVersionNumber){ if(ScriptVersion = UpdateVersionNumber OR ScriptVersion > UpdateVersionNumber){
ToolTip ToolTip
return 0 return 0
} }
else, { else, {
UpdateAvailable := 1 UpdateAvailable := 1
; msgbox, update found! ; msgbox, update found!
Message = Program Update Found Message = Program Update Found
@@ -36,7 +41,12 @@ CheckForUpdates(GitReleasesAPIURL){
UpdateScript(){ UpdateScript(){
data := URLDownloadToVar(GitReleasesAPIURL) data := URLDownloadToVar(GitReleasesAPIURL)
parsed := JSON.Load(data) try parsed := JSON.Load(data)
catch e {
Message = Failed to check for updates. Gitea Releases API returned blank or malformed data.
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Return
}
UpdateVersionNumber := parsed.1.name UpdateVersionNumber := parsed.1.name
ChangeLog := parsed.1.body ChangeLog := parsed.1.body

View File

@@ -20,9 +20,9 @@ IfMsgBox Yes, {
; Open Instructions Gitea page ; Open Instructions Gitea page
if(InStr(A_ScriptName, "Video")) if(InStr(A_ScriptName, "Video"))
URL = https://git.freedomainplaylists.com/yuriy/Freedomain-Video-Uploader#installation URL = https://freedomain.dev/yuriy/video-uploader#installation
else, else,
URL = https://git.freedomainplaylists.com/yuriy/Freedomain-Social-Media-Poster#installation URL = https://freedomain.dev/yuriy/social-media-poster#installation
run, %URL% run, %URL%
run, "%A_ScriptFullPath%" "LastPost" run, "%A_ScriptFullPath%" "LastPost"

View File

@@ -1,6 +1,12 @@
URLDownloadToVar(url){ URLDownloadToVar(url){
hObject:=ComObjCreate("WinHttp.WinHttpRequest.5.1") hObject:=ComObjCreate("WinHttp.WinHttpRequest.5.1")
hObject.Open("GET",url) hObject.Open("GET",url)
hObject.Send()
try hObject.Send()
catch e {
return ""
; msgbox, failed!
}
return hObject.ResponseText return hObject.ResponseText
} }