Compare commits
12 Commits
1962743565
...
e32fe026e9
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e32fe026e9 | ||
| 981051a9e8 | |||
|
|
f15d3ed2f0 | ||
|
|
05800d08a9 | ||
|
|
7d967c7f33 | ||
|
|
1dd0557970 | ||
| 1e77871bd8 | |||
|
|
57e132fafd | ||
| 71b950c57f | |||
| cf82847058 | |||
| cfce669061 | |||
| 0b9b63b715 |
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
Chromedriver-Mover.exe
|
||||
@@ -37,10 +37,10 @@ DownloadLatestChromium(){
|
||||
ChromeDriverDownloadFilepath = %ParentFolder%\chromedriver-win64
|
||||
ChromeDriverTemporaryExeFilepath = %ParentFolder%\chromedriver-win64\chromedriver-win64\chromedriver.exe
|
||||
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
|
||||
ChromeDriverMoverURL = https://git.freedomainplaylists.com/yuriy/Chromedriver-Mover/releases/download/1.0/Chromedriver-Mover.exe
|
||||
ChromeDriverMoverURL = https://freedomain.dev/attachments/b7b608b6-379a-42bb-a7c4-23fd67a05bb3
|
||||
|
||||
ChromeDriverProgramFilesExeFilepath = C:\Program Files\SeleniumBasic\chromedriver.exe
|
||||
|
||||
@@ -79,7 +79,7 @@ DownloadLatestChromium(){
|
||||
FileRemoveDir, %ChromeDriverDownloadFilepath%, 1
|
||||
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
|
||||
|
||||
|
||||
|
||||
Message = Downloading Chromedriver v%ChromeStableLatestVersion%
|
||||
Message = Downloading Chromedriver v%ChromeStableLatestVersion% to:`n%ChromeDriverDownloadZipFilepath%
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
UrlDownloadToFile, %chromedriverDLURL64%, %ChromeDriverDownloadZipFilepath%
|
||||
|
||||
Message = Downloading Chromium v%ChromeStableLatestVersion%
|
||||
Message = Downloading Chromium v%ChromeStableLatestVersion% to:`n%ChromeDownloadZipFilepath%
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
UrlDownloadToFile, %chromeDLURL64%, %ChromeDownloadZipFilepath%
|
||||
|
||||
@@ -107,16 +132,36 @@ DownloadLatestChromium(){
|
||||
Message = Deleting Old Chromium Directory
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
|
||||
FileRemoveDir, %ChromeDownloadFilepath%, 1
|
||||
if(FileExist(ChromeDownloadFilepath)){
|
||||
Message = Failed to delete the old Chromium. `nPlease manually delete the following directory and then run the Chrome Update again.`n`n %ChromeDownloadFilepath%
|
||||
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%
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar")
|
||||
|
||||
MsgBox 0x10,, %Message%
|
||||
|
||||
ToolTip
|
||||
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
|
||||
@@ -125,13 +170,16 @@ DownloadLatestChromium(){
|
||||
|
||||
Message = Extracting Chromium v%ChromeStableLatestVersion% Zip file
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
Unzip(ChromeDownloadZipFilepath, ChromeDownloadFilepath)
|
||||
Unzip(ChromeDownloadZipFilepath, ChromeExtractedDirectory)
|
||||
|
||||
|
||||
|
||||
|
||||
; 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
|
||||
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")
|
||||
|
||||
Loop, 30 {
|
||||
@@ -250,7 +298,7 @@ GetInstalledChromeFilepath(){
|
||||
ChromeFilepath := ChromePortableFilepath
|
||||
|
||||
Message = Using Chromium Portable for Upload
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
}
|
||||
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%
|
||||
|
||||
71
Chromedriver-Mover-Compiler.ahk
Normal file
71
Chromedriver-Mover-Compiler.ahk
Normal file
@@ -0,0 +1,71 @@
|
||||
;---ENVIRONMENT---------------------------------------------------------------------
|
||||
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
|
||||
;#Warn ; Enable warnings to assist with detecting common errors.
|
||||
;DetectHiddenWindows, On
|
||||
#SingleInstance, Force
|
||||
DetectHiddenWindows, ON
|
||||
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
|
||||
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
|
||||
;SetKeyDelay, 500
|
||||
CoordMode, ToolTip, Screen
|
||||
CoordMode, Mouse, Screen
|
||||
; #NoTrayIcon
|
||||
; Menu, Tray, Icon, RMScriptManager.ico
|
||||
|
||||
;---Notes/Extra Info/#Includes------------------------------------------------------
|
||||
|
||||
|
||||
;---VARIABLES-----------------------------------------------------------------------
|
||||
|
||||
;---MAIN SCRIPT---------------------------------------------------------------------
|
||||
|
||||
AHKFilepath = %A_ScriptDir%\Chromedriver-Mover.ahk
|
||||
Exefilepath = %A_ScriptDir%\Chromedriver-Mover.exe
|
||||
icopath = %A_ScriptDir%\Chromedriver-Mover.ico
|
||||
|
||||
|
||||
|
||||
; Kill any active intances of the uploaders so the .exe file can be overwriten by the compilation
|
||||
process, close, Chromedriver-Mover.exe
|
||||
|
||||
sleep, 1000
|
||||
|
||||
; Delete the .exe file so it can be repalced
|
||||
if(FileExist(Exefilepath)){
|
||||
FileDelete, %Exefilepath%
|
||||
if(ErrorLevel){
|
||||
msgbox, failed to delete Exe file. Please delete manually and re-run the compiler.
|
||||
ExitApp
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(!FileExist(AHKFilepath)){
|
||||
msgbox, %AHKFilepath% does not exist`nExiting
|
||||
ExitApp
|
||||
}
|
||||
|
||||
|
||||
if(!FileExist(icopath)){
|
||||
msgbox, %icopath% does not exist`nExiting
|
||||
ExitApp
|
||||
}
|
||||
|
||||
|
||||
run, %comspec% /c ""C:\Program Files\AutoHotkey\Compiler\Ahk2Exe.exe" /in "%AHKFilepath%" /out "%exefilepath%" /icon "%icopath%""
|
||||
|
||||
ExitApp
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
;---FUNCTIONS-----------------------------------------------------------------------
|
||||
133
Chromedriver-Mover.ahk
Normal file
133
Chromedriver-Mover.ahk
Normal file
@@ -0,0 +1,133 @@
|
||||
; ENVIRONMENT
|
||||
;------------------------------------------------
|
||||
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
|
||||
;#Warn ; Enable warnings to assist with detecting common errors.
|
||||
;DetectHiddenWindows, On
|
||||
#SingleInstance, Force
|
||||
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
|
||||
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
|
||||
;SetKeyDelay, 500
|
||||
CoordMode, ToolTip, Screen
|
||||
CoordMode, Mouse, Screen
|
||||
; #NoTrayIcon
|
||||
|
||||
; Notes/Extra Info/#Includes
|
||||
;------------------------------------------------
|
||||
; #Include C:\Users\%A_Username%\Syncthing\Scripts\AutoHotKey\RadialMenu\My codes\My Global Variables.ahk
|
||||
|
||||
if(InStr(A_ScriptFullPath, ".ahk")){
|
||||
try Menu, Tray, Icon, %A_ScriptDir%\Assets\icon.ico
|
||||
}
|
||||
|
||||
; Menu, Tray, Icon, C:\Users\%A_Username%\Syncthing\Git\Copy-ChromeDriver-To-Program-Files\Assets\icon.ico
|
||||
|
||||
ChromeDriverTemporaryFilepath = %1%
|
||||
|
||||
; Msgbox % "Passed in ChromeDriverTemporaryFilepath: " ChromeDriverTemporaryFilepath
|
||||
|
||||
; msgbox
|
||||
; VARIABLES
|
||||
;------------------------------------------------
|
||||
SettingsFilepath = %A_ScriptDir%\ChromedriverMover.ini
|
||||
|
||||
; Msgbox % "SettingsFilepath: " SettingsFilepath
|
||||
if(ChromeDriverTemporaryFilepath)
|
||||
IniWrite, %ChromeDriverTemporaryFilepath%, %SettingsFilepath%, Selenium, ChromeDriverTemporaryFilepath
|
||||
|
||||
|
||||
; MAIN SCRIPT
|
||||
;------------------------------------------------
|
||||
StartScriptAsAdmin()
|
||||
|
||||
if(ChromeDriverTemporaryFilepath = "")
|
||||
IniRead, ChromeDriverTemporaryFilepath, %SettingsFilepath%, Selenium, ChromeDriverTemporaryFilepath
|
||||
|
||||
|
||||
ChromeDriverProgramFilesFilepath = C:\Program Files\SeleniumBasic\chromedriver.exe
|
||||
|
||||
|
||||
if(FileExist(ChromeDriverProgramFilesFilepath)){
|
||||
|
||||
FileDelete, %ChromeDriverProgramFilesFilepath%
|
||||
if(ErrorLevel){
|
||||
msgbox, failed to delete old chromedriver from: C:\Program Files\SeleniumBasic\chromedriver.exe. Please make sure all Selenium Connected instances of Chromium are closed and then try again or move the Chromedriver.exe file manually from:`n%ChromeDriverTemporaryFilepath%
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if(FileExist(ChromeDriverProgramFilesFilepath)){
|
||||
msgbox, failed to delete old chromedriver from: C:\Program Files\SeleniumBasic\chromedriver.exe. Please run this program as admin or move the chromedriver manually from:`n%ChromeDriverTemporaryFilepath%
|
||||
ExitApp
|
||||
}
|
||||
|
||||
; msgbox, pause
|
||||
|
||||
; Msgbox % "ChromeDriverTemporaryFilepath: " ChromeDriverTemporaryFilepath
|
||||
|
||||
if(!InStr(ChromeDriverTemporaryFilepath, ".exe")){ ; parent directory passed in instead of exact filepath. Loop through directory contents and find the .exe file
|
||||
|
||||
Loop, files, %ChromeDriverTemporaryFilepath%\*.*, DFR
|
||||
{ ; D = Directories, F = Files, R = Recursive
|
||||
|
||||
SplitPath, A_LoopFileFullPath, FileNameWExt, FileDir, FileExt, FileNameNoExt,
|
||||
|
||||
if(FileNameWExt = "chromedriver.exe"){
|
||||
ChromeDriverTemporaryFilepath := A_LoopFileFullPath
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(!InStr(ChromeDriverTemporaryFilepath, ".exe")){
|
||||
msgbox, Failed to find chromedriver.exe to move. Please move the chromedriver manually.
|
||||
ExitApp
|
||||
}
|
||||
|
||||
|
||||
FileCopy, %ChromeDriverTemporaryFilepath%, %ChromeDriverProgramFilesFilepath%, 1
|
||||
if(ErrorLevel){
|
||||
msgbox, unable to copy chromedriver.exe from: `n%ChromeDriverTemporaryFilepath%`nto:`n%ChromeDriverProgramFilesFilepath%
|
||||
ExitApp
|
||||
}
|
||||
|
||||
|
||||
if(!FileExist(ChromeDriverProgramFilesFilepath)){
|
||||
msgbox, failed to move chromedriver to %ChromeDriverProgramFilesFilepath%. Please run this program as admin or move the chromedriver manually.
|
||||
ExitApp
|
||||
}
|
||||
|
||||
; clear the settings file
|
||||
IniWrite, %A_Tab%, %SettingsFilepath%, Selenium, ChromeDriverTemporaryFilepath
|
||||
|
||||
ExitApp
|
||||
|
||||
|
||||
|
||||
; Functions
|
||||
;------------------------------------------------
|
||||
|
||||
StartScriptAsAdmin(){
|
||||
full_command_line := DllCall("GetCommandLine", "str")
|
||||
|
||||
if not (A_IsAdmin or RegExMatch(full_command_line, " /restart(?!\S)")) {
|
||||
try {
|
||||
if A_IsCompiled
|
||||
Run *RunAs "%A_ScriptFullPath%" /restart
|
||||
else
|
||||
Run *RunAs "%A_AhkPath%" /restart "%A_ScriptFullPath%"
|
||||
}
|
||||
ExitApp
|
||||
}
|
||||
|
||||
if(!A_IsAdmin){
|
||||
Msgbox, failed to get admin to move chromedriver to program files
|
||||
Return
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
; Misc
|
||||
;------------------------------------------------
|
||||
; Escape::ExitApp
|
||||
BIN
Chromedriver-Mover.ico
Normal file
BIN
Chromedriver-Mover.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 179 KiB |
@@ -8,7 +8,12 @@ CheckForUpdates(GitReleasesAPIURL){
|
||||
data := URLDownloadToVar(GitReleasesAPIURL)
|
||||
; 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
|
||||
|
||||
@@ -17,10 +22,10 @@ CheckForUpdates(GitReleasesAPIURL){
|
||||
|
||||
|
||||
if(ScriptVersion = UpdateVersionNumber OR ScriptVersion > UpdateVersionNumber){
|
||||
ToolTip
|
||||
return 0
|
||||
}
|
||||
else, {
|
||||
ToolTip
|
||||
return 0
|
||||
}
|
||||
else, {
|
||||
UpdateAvailable := 1
|
||||
; msgbox, update found!
|
||||
Message = Program Update Found
|
||||
@@ -36,7 +41,12 @@ CheckForUpdates(GitReleasesAPIURL){
|
||||
UpdateScript(){
|
||||
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
|
||||
ChangeLog := parsed.1.body
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
Function Libraries used in the following Projects:
|
||||
- [Freedomain Social Media Poster](https://git.freedomainplaylists.com/yuriy/Freedomain-Social-Media-Poster)
|
||||
- [Freedomain Video Uploader](https://git.freedomainplaylists.com/yuriy/Freedomain-Video-Uploader)
|
||||
- [Freedomain Reposter](https://git.freedomainplaylists.com/yuriy/Freedomain-Reposter)
|
||||
- [Freedomain Social Media Poster](https://freedomain.dev/yuriy/social-media-poster)
|
||||
- [Freedomain Video Uploader](https://freedomain.dev/yuriy/video-uploader)
|
||||
@@ -20,9 +20,9 @@ IfMsgBox Yes, {
|
||||
; Open Instructions Gitea page
|
||||
|
||||
if(InStr(A_ScriptName, "Video"))
|
||||
URL = https://git.freedomainplaylists.com/yuriy/Freedomain-Video-Uploader#installation
|
||||
URL = https://freedomain.dev/yuriy/video-uploader#installation
|
||||
else,
|
||||
URL = https://git.freedomainplaylists.com/yuriy/Freedomain-Social-Media-Poster#installation
|
||||
URL = https://freedomain.dev/yuriy/social-media-poster#installation
|
||||
|
||||
run, %URL%
|
||||
run, "%A_ScriptFullPath%" "LastPost"
|
||||
|
||||
@@ -1,6 +1,15 @@
|
||||
URLDownloadToVar(url){
|
||||
|
||||
hObject:=ComObjCreate("WinHttp.WinHttpRequest.5.1")
|
||||
hObject.Open("GET",url)
|
||||
hObject.Send()
|
||||
|
||||
try {
|
||||
hObject.Send()
|
||||
}
|
||||
catch e {
|
||||
; MsgBox, 4096, Error, Failed to connect to:`n`n%url%`n`nAre you connected to the internet? Or is the website down?`n`nDisable Auto Update Check to disable this message.
|
||||
return ""
|
||||
}
|
||||
|
||||
return hObject.ResponseText
|
||||
}
|
||||
Reference in New Issue
Block a user