Compare commits
8 Commits
2e0c81f34f
...
0e02ae24bd
| Author | SHA1 | Date | |
|---|---|---|---|
| 0e02ae24bd | |||
| b19482e10d | |||
| d7d3ce039f | |||
| 8395c5c367 | |||
| 124a26c3b0 | |||
| b5c3b4a606 | |||
|
|
43dd2c3f28 | ||
|
|
88c48e133e |
@@ -153,6 +153,7 @@ DownloadLatestChromium(){
|
||||
|
||||
Process, Close, chromedriver.exe
|
||||
sleep, 5000 ; wait 5 seconds before checking again
|
||||
continue
|
||||
}
|
||||
else,
|
||||
break
|
||||
|
||||
@@ -137,6 +137,10 @@ CheckDirExistAndCreate(Path){
|
||||
; -------------------------------/CheckDirExistAndCreate-------------------------------
|
||||
|
||||
|
||||
; Script Updates
|
||||
; ------------------------------------------------
|
||||
|
||||
|
||||
|
||||
CheckIfUpdateAvailable(Filepath, CurrentVersion){
|
||||
FileRead, ScriptUpdateContents, %Filepath%
|
||||
@@ -375,19 +379,6 @@ Return Var
|
||||
}
|
||||
|
||||
|
||||
|
||||
; OnMsgbox Functions
|
||||
;------------------------------------------------
|
||||
OnMsgBoxUpdateAvailable() {
|
||||
DetectHiddenWindows, On
|
||||
Process, Exist
|
||||
If (WinExist("ahk_class #32770 ahk_pid " . ErrorLevel)) {
|
||||
ControlSetText Button1, Cancel
|
||||
ControlSetText Button2, Install
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SaveCurrentChromeVersionToIniFile(){
|
||||
|
||||
if(InstalledChromeVersion = "")
|
||||
@@ -427,14 +418,7 @@ HasSubstringVal(haystack, needle)
|
||||
|
||||
; -------------------------------Functions-------------------------------
|
||||
|
||||
OnMsgBoxConfirmChromiumOverwrite() {
|
||||
DetectHiddenWindows, On
|
||||
Process, Exist
|
||||
If (WinExist("ahk_class #32770 ahk_pid " . ErrorLevel)) {
|
||||
ControlSetText Button1, Cancel
|
||||
ControlSetText Button2, Yes
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
; https://www.autohotkey.com/docs/v2/Functions.htm#Variadic
|
||||
Join(sep, params*) {
|
||||
@@ -477,23 +461,6 @@ AddToTotalVideosUploadedCount(){
|
||||
|
||||
|
||||
|
||||
OnMsgBoxPodcastFinish() {
|
||||
DetectHiddenWindows, On
|
||||
Process, Exist
|
||||
If (WinExist("ahk_class #32770 ahk_pid " . ErrorLevel)) {
|
||||
WinMove,, 0
|
||||
}
|
||||
}
|
||||
|
||||
OnMsgBoxSocialMediaPoster() {
|
||||
DetectHiddenWindows, On
|
||||
Process, Exist
|
||||
If (WinExist("ahk_class #32770 ahk_pid " . ErrorLevel)) {
|
||||
ControlSetText Button1, Yes
|
||||
ControlSetText Button2, Not Now
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Check_For_Stuck_Video_Upload(Index_Number, Upload_Status){
|
||||
@@ -616,8 +583,6 @@ CreateErrorLoggingFiles(Directory := ""){
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
; if passed argument is .exe file, then script has just been updated and we need to delete the old .exe file
|
||||
CheckIfUpdateInstalled(PassedInArgument :=""){
|
||||
|
||||
@@ -632,3 +597,62 @@ CheckIfUpdateInstalled(PassedInArgument :=""){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
; https://www.autohotkey.com/boards/viewtopic.php?t=59936
|
||||
GetDateOrdinalSuffix(D) {
|
||||
Static Special := {1: "st", 2: "nd", 3: "rd", 21: "st", 22: "nd", 23: "rd", 31: "st"}
|
||||
Return D . ((S := Special[D]) ? S : "th")
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
; OnMsgbox - Custom Msgbox Screens
|
||||
;------------------------------------------------
|
||||
OnMsgBoxUpdateAvailable() {
|
||||
DetectHiddenWindows, On
|
||||
Process, Exist
|
||||
If (WinExist("ahk_class #32770 ahk_pid " . ErrorLevel)) {
|
||||
ControlSetText Button1, Cancel
|
||||
ControlSetText Button2, Install
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
; Show a user confirmation msgbox with a PROCEED and STOP buttons
|
||||
; Used by the "Confirm before Submit" checkbox
|
||||
OnMsgBoxUserConfirmation() {
|
||||
DetectHiddenWindows, On
|
||||
Process, Exist
|
||||
If (WinExist("ahk_class #32770 ahk_pid " . ErrorLevel)) {
|
||||
ControlSetText Button1, PROCEED
|
||||
ControlSetText Button2, STOP
|
||||
}
|
||||
}
|
||||
|
||||
OnMsgBoxConfirmChromiumOverwrite() {
|
||||
DetectHiddenWindows, On
|
||||
Process, Exist
|
||||
If (WinExist("ahk_class #32770 ahk_pid " . ErrorLevel)) {
|
||||
ControlSetText Button1, Cancel
|
||||
ControlSetText Button2, Yes
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
OnMsgBoxPodcastFinish() {
|
||||
DetectHiddenWindows, On
|
||||
Process, Exist
|
||||
If (WinExist("ahk_class #32770 ahk_pid " . ErrorLevel)) {
|
||||
WinMove,, 0
|
||||
}
|
||||
}
|
||||
|
||||
OnMsgBoxSocialMediaPoster() {
|
||||
DetectHiddenWindows, On
|
||||
Process, Exist
|
||||
If (WinExist("ahk_class #32770 ahk_pid " . ErrorLevel)) {
|
||||
ControlSetText Button1, Yes
|
||||
ControlSetText Button2, Not Now
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
Function Libraries used in the following Projects:
|
||||
- [Freedomain Social Media Poster](https://freedomain.dev/yuriy/social-media-poster)
|
||||
- [Freedomain Video Uploader](https://freedomain.dev/yuriy/video-uploader)
|
||||
- [Freedomain Clips Uploader](https://freedomain.dev/yuriy/clips-uploader)
|
||||
- [Freedomain Livestream Scheduler](https://freedomain.dev/yuriy/livestream-scheduler)
|
||||
@@ -720,8 +720,20 @@ Selenium_LoopToSendValueByName(ElementName,NumOfLoops:=1,SleepLength:=1000,Strin
|
||||
}
|
||||
}
|
||||
|
||||
Selenium_LoopToSendValueToXpath(Xpath,NumOfLoops:=1,SleepLength:=1000,StringTextContent:=""){
|
||||
Selenium_LoopToSendValueToXpath(Xpath,NumOfLoops:=1,SleepLength:=1000,StringTextContent:="",ClearElement:=0){
|
||||
; Msgbox % "StringTextContent: " StringTextContent
|
||||
; Msgbox % "ClearElement: " ClearElement
|
||||
|
||||
loop, %NumOfLoops% {
|
||||
; msgbox % ClearElement
|
||||
if(ClearElement){
|
||||
Loop, 3 { ; have to do it multiple times to make it trigger properly
|
||||
try, driver.FindElementByXPath(Xpath).clear()
|
||||
sleep, 500
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
; ToolTip, Loop attempt: %A_index%
|
||||
try driver.FindElementByXPath(Xpath).sendKeys(StringTextContent) ; Click on "upload image" button
|
||||
catch e {
|
||||
@@ -778,17 +790,27 @@ Selenium_LoopToClickXpathAndWaitForOpenWindow(Xpath,NumOfLoops:=1,SleepLength:=1
|
||||
}
|
||||
|
||||
|
||||
Selenium_LoopToClearXpath(Xpath,NumOfLoops:=1,SleepLength:=1000){
|
||||
loop, %NumOfLoops% {
|
||||
Selenium_LoopToClearXpath(Xpath,NumberOfAttemps:=1,SleepLength:=1000){
|
||||
loop, %NumberOfAttemps% {
|
||||
|
||||
try driver.FindElementByXPath(Xpath).clear()
|
||||
catch e {
|
||||
if(A_index = NumOfLoops){
|
||||
Return "Failed"
|
||||
}
|
||||
sleep, %SleepLength%
|
||||
Continue
|
||||
Return "Failed"
|
||||
}
|
||||
Return
|
||||
|
||||
sleep, %SleepLength%
|
||||
|
||||
try, InerText := driver.findelementbyxpath(Xpath).Attribute("value")
|
||||
; Msgbox % "InerText: " InerText
|
||||
if(InerText = "")
|
||||
return
|
||||
|
||||
if(A_index = NumberOfAttemps){
|
||||
return "Failed after %NumberOfAttemps"
|
||||
}
|
||||
|
||||
Continue
|
||||
; Return
|
||||
}
|
||||
}
|
||||
|
||||
@@ -822,26 +844,26 @@ SaveDriverURLOFErrorPage(){ ; save the url of the result page. That way if a tab
|
||||
|
||||
GetHTMLValueFromXpathOuterHTML(XPATH, HTMLElementName){
|
||||
|
||||
Try ElementOuterHTML := driver.findelementbyxpath(Xpath).Attribute("outerHTML") ;XPATH-ID & Tag
|
||||
; try Clipboard := driver.findelementbyxpath(Xpath).Attribute("outerHTML") ;XPATH-ID & Tag
|
||||
; Try MsgBox,,Element OuterHTML: `n, % driver.findelementbyxpath(Xpath).Attribute("outerHTML") ;XPATH-ID & Tag
|
||||
Try ElementOuterHTML := driver.findelementbyxpath(Xpath).Attribute("outerHTML") ;XPATH-ID & Tag
|
||||
; try Clipboard := driver.findelementbyxpath(Xpath).Attribute("outerHTML") ;XPATH-ID & Tag
|
||||
; Try MsgBox,,Element OuterHTML: `n, % driver.findelementbyxpath(Xpath).Attribute("outerHTML") ;XPATH-ID & Tag
|
||||
|
||||
; Match string between quotes following the HTMLELEMENTNAME
|
||||
RegexStatement = %HTMLElementName%="([^"]+)"
|
||||
; Match string between quotes following the HTMLELEMENTNAME
|
||||
RegexStatement = %HTMLElementName%="([^"]+)"
|
||||
|
||||
; regexMatch := RegExMatch(ElementOuterHTML, "value=""([^""]+)""", match)
|
||||
regexMatch := RegExMatch(ElementOuterHTML, RegexStatement, match)
|
||||
if (regexMatch)
|
||||
{
|
||||
ElementValue := match1
|
||||
; Msgbox % "PostURL: " PostURL
|
||||
; Message = URL Pulled out from OuterHTML: %PostURL%
|
||||
Return ElementValue
|
||||
ElementValue := match1
|
||||
; Msgbox % "PostURL: " PostURL
|
||||
; Message = URL Pulled out from OuterHTML: %PostURL%
|
||||
Return ElementValue
|
||||
}
|
||||
else {
|
||||
Message = Failed to Pull out value from OuterHTML
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||
Return "Failed"
|
||||
Message = Failed to Pull out value from OuterHTML
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||
Return "Failed"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
21
Update-Functions.ahk
Normal file
21
Update-Functions.ahk
Normal file
@@ -0,0 +1,21 @@
|
||||
; This #include needs to be at the bottom of the parent script
|
||||
|
||||
|
||||
CheckForUpdates:
|
||||
; The GUI buttons must have variable set to vUpdateAvailable and vChromeUpdateAvailable for button to get updated
|
||||
|
||||
; The following variables need to be set in the parent script
|
||||
; GitReleasesAPIURL
|
||||
; ChromeFilepath
|
||||
|
||||
Message = Checking for Updates
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
|
||||
if(CheckForUpdates(GitReleasesAPIURL))
|
||||
GuiControl,,UpdateAvailable, Uploader Update Available!
|
||||
|
||||
if(CheckForChromeUpdates(ChromeFilepath)){
|
||||
GuiControl,,ChromeUpdateAvailable, Chrome Update Available!
|
||||
ChromeUpdateAvailable := 1
|
||||
}
|
||||
Return
|
||||
Reference in New Issue
Block a user