Compare commits
12 Commits
b8ffb10db1
...
b378de8106
| Author | SHA1 | Date | |
|---|---|---|---|
| b378de8106 | |||
| ed307493b8 | |||
| 2860e4868f | |||
| 0e02ae24bd | |||
| b19482e10d | |||
| d7d3ce039f | |||
| 8395c5c367 | |||
| 124a26c3b0 | |||
| b5c3b4a606 | |||
|
|
43dd2c3f28 | ||
|
|
88c48e133e | ||
|
|
2e0c81f34f |
@@ -153,6 +153,7 @@ DownloadLatestChromium(){
|
|||||||
|
|
||||||
Process, Close, chromedriver.exe
|
Process, Close, chromedriver.exe
|
||||||
sleep, 5000 ; wait 5 seconds before checking again
|
sleep, 5000 ; wait 5 seconds before checking again
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
else,
|
else,
|
||||||
break
|
break
|
||||||
|
|||||||
@@ -137,6 +137,10 @@ CheckDirExistAndCreate(Path){
|
|||||||
; -------------------------------/CheckDirExistAndCreate-------------------------------
|
; -------------------------------/CheckDirExistAndCreate-------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
; Script Updates
|
||||||
|
; ------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CheckIfUpdateAvailable(Filepath, CurrentVersion){
|
CheckIfUpdateAvailable(Filepath, CurrentVersion){
|
||||||
FileRead, ScriptUpdateContents, %Filepath%
|
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(){
|
SaveCurrentChromeVersionToIniFile(){
|
||||||
|
|
||||||
if(InstalledChromeVersion = "")
|
if(InstalledChromeVersion = "")
|
||||||
@@ -425,3 +416,254 @@ HasSubstringVal(haystack, needle)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; -------------------------------Functions-------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; https://www.autohotkey.com/docs/v2/Functions.htm#Variadic
|
||||||
|
Join(sep, params*) {
|
||||||
|
For index, param in params
|
||||||
|
str .= param . sep
|
||||||
|
return SubStr(str, 1, -StrLen(sep))
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
LogErrorToTextFile(Error){
|
||||||
|
/* if(LogErrorsToTextFile != 1)
|
||||||
|
Return
|
||||||
|
*/
|
||||||
|
ErrorLoggingFile := VideoFolderDir . "\" . "ErrorLogging.txt"
|
||||||
|
FormatTime, TodayDate , YYYYMMDDHH24MISS, yyyyMMdd_hhmmss
|
||||||
|
text =
|
||||||
|
(
|
||||||
|
|
||||||
|
|
||||||
|
---------------%TodayDate%---------------
|
||||||
|
%CurrentSite%: %Error%
|
||||||
|
|
||||||
|
|
||||||
|
)
|
||||||
|
if(LogErrorsToMsgbox)
|
||||||
|
Msgbox % "Text: " Text
|
||||||
|
|
||||||
|
FileAppend, %Text%, %ErrorLoggingFile%
|
||||||
|
} ; End of Function
|
||||||
|
|
||||||
|
/*
|
||||||
|
*/
|
||||||
|
|
||||||
|
AddToTotalVideosUploadedCount(){
|
||||||
|
; IniRead, TotalVideosUploaded, %SettingsIniFilepath%, General, TotalVideosUploaded, %A_Space%
|
||||||
|
TotalVideosUploaded += 1
|
||||||
|
; IniWrite, %TotalVideosUploaded%, %SettingsIniFilepath%, General, TotalVideosUploaded
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Check_For_Stuck_Video_Upload(Index_Number, Upload_Status){
|
||||||
|
if(A_index = 1){ ; Create a blank array
|
||||||
|
ProgressStatusArray := []
|
||||||
|
Return
|
||||||
|
}
|
||||||
|
|
||||||
|
Message = Upload Status: %Upload_Status%
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip")
|
||||||
|
|
||||||
|
; if we reached the last loop number:
|
||||||
|
if(A_index = %Number_of_loops_to_Check_Upload_status%){
|
||||||
|
Message = Upload Most Likely Failed: Video Hasn't Finished Uploading after 1 hour.
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||||
|
SaveDriverURLOFErrorPage()
|
||||||
|
Return "Failed"
|
||||||
|
}
|
||||||
|
|
||||||
|
; If progress is still the same after a ten minute interval then error out
|
||||||
|
if(HasVal(Array_Index_Num_of_Upload_StatusChecks, A_index)){ ; if current index is in Array of index numbers to check status during
|
||||||
|
|
||||||
|
; Send a notification message of upload status
|
||||||
|
Message = Upload Status: %Upload_Status%
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
|
||||||
|
; if current upload_status is in the array of values that are updated every 10 mins
|
||||||
|
if(HasVal(ProgressStatusArray, Upload_Status)){
|
||||||
|
Message = Upload Failed (E#4508)`nUpload Stuck at same point for 10 minutes. Stuck Status: %ProgressStatus%
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||||
|
SaveDriverURLOFErrorPage()
|
||||||
|
Return "Failed"
|
||||||
|
}
|
||||||
|
ProgressStatusArray.Push(Upload_Status) ; append current status to array
|
||||||
|
}
|
||||||
|
} ; end of func
|
||||||
|
|
||||||
|
/*
|
||||||
|
*/
|
||||||
|
; Find the longest word in a string of words
|
||||||
|
FindLongestWordInString(m, calloutNumber, pos, haystack, pattern){
|
||||||
|
Global wordLength, longestWord
|
||||||
|
|
||||||
|
len := StrLen(m)
|
||||||
|
|
||||||
|
If ( len > wordLength )
|
||||||
|
{
|
||||||
|
wordLength := len
|
||||||
|
longestWord := m
|
||||||
|
|
||||||
|
; MsgBox, %m%
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
*/
|
||||||
|
|
||||||
|
; Split a long string into multiple pieces based on the string lengtht you want and return an array with all strings
|
||||||
|
SplitStringWithSentences(text, maxChunkSize) {
|
||||||
|
sentences := StrSplit(text, "\. ") ; split at period with space after it
|
||||||
|
|
||||||
|
currentChunk := ""
|
||||||
|
chunks := []
|
||||||
|
|
||||||
|
Loop, % sentences.Length()
|
||||||
|
{
|
||||||
|
sentence := sentences[A_Index]
|
||||||
|
CurrentChunkAndSentence := currentChunk . sentence
|
||||||
|
; Msgbox % "CurrentChunkAndSentence: " CurrentChunkAndSentence
|
||||||
|
; msgbox % StrLen(CurrentChunkAndSentence)
|
||||||
|
|
||||||
|
if (StrLen(CurrentChunkAndSentence) <= maxChunkSize)
|
||||||
|
{
|
||||||
|
currentChunk .= sentence . "\. "
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
chunks.Push(currentChunk)
|
||||||
|
currentChunk := sentence . "\. "
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currentChunk != "")
|
||||||
|
chunks.Push(currentChunk)
|
||||||
|
|
||||||
|
return chunks
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CreateErrorLoggingFiles(Directory := ""){
|
||||||
|
FormatTime, TodayDate, YYYYMMDDHH24MISS, yyyyMMdd_hhmmss
|
||||||
|
|
||||||
|
ErrorLoggingDirectory := Directory
|
||||||
|
|
||||||
|
if(ErrorLoggingDirectory = ""){
|
||||||
|
ErrorLoggingDirectory := A_ScriptDir . "\Lib\ErrorLogging"
|
||||||
|
; If directory for error logging doesn't exist, create it
|
||||||
|
if(!FileExist(ErrorLoggingDirectory))
|
||||||
|
FileCreateDir, %ErrorLoggingDirectory%
|
||||||
|
|
||||||
|
ErrorLoggingDirectory := ErrorLoggingDirectory . "\" . TodayDate . "_" . ScriptAbbreviatedName
|
||||||
|
}
|
||||||
|
; Msgbox % "ErrorLoggingDirectory: " ErrorLoggingDirectory
|
||||||
|
FileCreateDir, %ErrorLoggingDirectory%
|
||||||
|
|
||||||
|
; Create variables with filepaths that content will be saved to.
|
||||||
|
global ErrorLoggingFilePath := ErrorLoggingDirectory . "\" . "ErrorLogging.txt"
|
||||||
|
global StatusFileFilePath := ErrorLoggingDirectory . "\" . "PostStatus.ini"
|
||||||
|
|
||||||
|
global PostTitleFilePath := ErrorLoggingDirectory . "\" . "PostTitle.txt"
|
||||||
|
global PostBodyFilePath := ErrorLoggingDirectory . "\" . "PostBody.txt"
|
||||||
|
global PostTagsFilePath := ErrorLoggingDirectory . "\" . "PostTags.txt"
|
||||||
|
|
||||||
|
PostStatusesFilepath := ErrorLoggingDirectory . "\" . "Status.ini"
|
||||||
|
; Msgbox % "ErrorLoggingDirectory: " ErrorLoggingDirectory
|
||||||
|
|
||||||
|
|
||||||
|
Return
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
; if passed argument is .exe file, then script has just been updated and we need to delete the old .exe file
|
||||||
|
CheckIfUpdateInstalled(PassedInArgument :=""){
|
||||||
|
|
||||||
|
if(InStr(PassedInArgument,".exe")){
|
||||||
|
|
||||||
|
FileDelete, %PassedInArgument%
|
||||||
|
if(ErrorLevel){ ; most likely because the old version hasn't finished exiting yet
|
||||||
|
Message = Failed to Delete Old .exe file after Updating
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
; 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
|
||||||
|
;------------------------------------------------
|
||||||
|
ConfirmBeforeSubmitMsgboxFunc(){
|
||||||
|
OnMessage(0x44, "OnMsgBoxUserConfirmation")
|
||||||
|
MsgBox 0x21, User Confirmation, Please check that all data was input correctly and fix any mistakes and then click PROCEED to finalize the Upload.`n`nClick STOP to cancel the rest of this Upload and move on to the next website.
|
||||||
|
OnMessage(0x44, "")
|
||||||
|
IfMsgBox OK, {
|
||||||
|
} Else IfMsgBox Cancel, {
|
||||||
|
Message = User Selected STOP button when asked for confirmation. Cancelling Rest of Site Upload.
|
||||||
|
Return %Message%
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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,158 +0,0 @@
|
|||||||
|
|
||||||
; -------------------------------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*) {
|
|
||||||
For index, param in params
|
|
||||||
str .= param . sep
|
|
||||||
return SubStr(str, 1, -StrLen(sep))
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
LogErrorToTextFile(Error){
|
|
||||||
/* if(LogErrorsToTextFile != 1)
|
|
||||||
Return
|
|
||||||
*/
|
|
||||||
ErrorLoggingFile := VideoFolderDir . "\" . "ErrorLogging.txt"
|
|
||||||
FormatTime, TodayDate , YYYYMMDDHH24MISS, yyyyMMdd_hhmmss
|
|
||||||
text =
|
|
||||||
(
|
|
||||||
|
|
||||||
|
|
||||||
---------------%TodayDate%---------------
|
|
||||||
%CurrentSite%: %Error%
|
|
||||||
|
|
||||||
|
|
||||||
)
|
|
||||||
if(LogErrorsToMsgbox)
|
|
||||||
Msgbox % "Text: " Text
|
|
||||||
|
|
||||||
FileAppend, %Text%, %ErrorLoggingFile%
|
|
||||||
} ; End of Function
|
|
||||||
|
|
||||||
/*
|
|
||||||
*/
|
|
||||||
|
|
||||||
AddToTotalVideosUploadedCount(){
|
|
||||||
; IniRead, TotalVideosUploaded, %SettingsIniFilepath%, General, TotalVideosUploaded, %A_Space%
|
|
||||||
TotalVideosUploaded += 1
|
|
||||||
; IniWrite, %TotalVideosUploaded%, %SettingsIniFilepath%, General, TotalVideosUploaded
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
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){
|
|
||||||
if(A_index = 1){ ; Create a blank array
|
|
||||||
ProgressStatusArray := []
|
|
||||||
Return
|
|
||||||
}
|
|
||||||
|
|
||||||
Message = Upload Status: %Upload_Status%
|
|
||||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip")
|
|
||||||
|
|
||||||
; if we reached the last loop number:
|
|
||||||
if(A_index = %Number_of_loops_to_Check_Upload_status%){
|
|
||||||
Message = Upload Most Likely Failed: Video Hasn't Finished Uploading after 1 hour.
|
|
||||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
|
||||||
SaveDriverURLOFErrorPage()
|
|
||||||
Return "Failed"
|
|
||||||
}
|
|
||||||
|
|
||||||
; If progress is still the same after a ten minute interval then error out
|
|
||||||
if(HasVal(Array_Index_Num_of_Upload_StatusChecks, A_index)){ ; if current index is in Array of index numbers to check status during
|
|
||||||
|
|
||||||
; Send a notification message of upload status
|
|
||||||
Message = Upload Status: %Upload_Status%
|
|
||||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
|
||||||
|
|
||||||
; if current upload_status is in the array of values that are updated every 10 mins
|
|
||||||
if(HasVal(ProgressStatusArray, Upload_Status)){
|
|
||||||
Message = Upload Failed (E#4508)`nUpload Stuck at same point for 10 minutes. Stuck Status: %ProgressStatus%
|
|
||||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
|
||||||
SaveDriverURLOFErrorPage()
|
|
||||||
Return "Failed"
|
|
||||||
}
|
|
||||||
ProgressStatusArray.Push(Upload_Status) ; append current status to array
|
|
||||||
}
|
|
||||||
} ; end of func
|
|
||||||
|
|
||||||
/*
|
|
||||||
*/
|
|
||||||
; Find the longest word in a string of words
|
|
||||||
FindLongestWordInString(m, calloutNumber, pos, haystack, pattern){
|
|
||||||
Global wordLength, longestWord
|
|
||||||
|
|
||||||
len := StrLen(m)
|
|
||||||
|
|
||||||
If ( len > wordLength )
|
|
||||||
{
|
|
||||||
wordLength := len
|
|
||||||
longestWord := m
|
|
||||||
|
|
||||||
; MsgBox, %m%
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
*/
|
|
||||||
|
|
||||||
; Split a long string into multiple pieces based on the string lengtht you want and return an array with all strings
|
|
||||||
SplitStringWithSentences(text, maxChunkSize) {
|
|
||||||
sentences := StrSplit(text, "\. ") ; split at period with space after it
|
|
||||||
|
|
||||||
currentChunk := ""
|
|
||||||
chunks := []
|
|
||||||
|
|
||||||
Loop, % sentences.Length()
|
|
||||||
{
|
|
||||||
sentence := sentences[A_Index]
|
|
||||||
CurrentChunkAndSentence := currentChunk . sentence
|
|
||||||
; Msgbox % "CurrentChunkAndSentence: " CurrentChunkAndSentence
|
|
||||||
; msgbox % StrLen(CurrentChunkAndSentence)
|
|
||||||
|
|
||||||
if (StrLen(CurrentChunkAndSentence) <= maxChunkSize)
|
|
||||||
{
|
|
||||||
currentChunk .= sentence . "\. "
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
chunks.Push(currentChunk)
|
|
||||||
currentChunk := sentence . "\. "
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (currentChunk != "")
|
|
||||||
chunks.Push(currentChunk)
|
|
||||||
|
|
||||||
return chunks
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
Function Libraries used in the following Projects:
|
Function Libraries used in the following Projects:
|
||||||
- [Freedomain Social Media Poster](https://freedomain.dev/yuriy/social-media-poster)
|
- [Freedomain Social Media Poster](https://freedomain.dev/yuriy/social-media-poster)
|
||||||
- [Freedomain Video Uploader](https://freedomain.dev/yuriy/video-uploader)
|
- [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,10 +720,28 @@ 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){
|
||||||
|
|
||||||
loop, %NumOfLoops% {
|
loop, %NumOfLoops% {
|
||||||
; ToolTip, Loop attempt: %A_index%
|
|
||||||
try driver.FindElementByXPath(Xpath).sendKeys(StringTextContent) ; Click on "upload image" button
|
if(ClearElement){
|
||||||
|
Loop, 3 { ; sometimes have to do it multiple times to make it trigger properly
|
||||||
|
Try PreviousValue := driver.findelementbyxpath(Xpath).Attribute("value") ;Xpath Value
|
||||||
|
|
||||||
|
try, driver.FindElementByXPath(Xpath).clear()
|
||||||
|
|
||||||
|
Try CurrentValue := driver.findelementbyxpath(Xpath).Attribute("value") ;Xpath Value
|
||||||
|
|
||||||
|
if(PreviousValue != CurrentValue){
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
sleep, 1000
|
||||||
|
; msgbox
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try driver.FindElementByXPath(Xpath).sendKeys(StringTextContent) ; Input Text
|
||||||
catch e {
|
catch e {
|
||||||
if(A_index = NumOfLoops){
|
if(A_index = NumOfLoops){
|
||||||
Return "Failed"
|
Return "Failed"
|
||||||
@@ -778,17 +796,27 @@ Selenium_LoopToClickXpathAndWaitForOpenWindow(Xpath,NumOfLoops:=1,SleepLength:=1
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Selenium_LoopToClearXpath(Xpath,NumOfLoops:=1,SleepLength:=1000){
|
Selenium_LoopToClearXpath(Xpath,NumberOfAttemps:=1,SleepLength:=1000){
|
||||||
loop, %NumOfLoops% {
|
loop, %NumberOfAttemps% {
|
||||||
|
|
||||||
try driver.FindElementByXPath(Xpath).clear()
|
try driver.FindElementByXPath(Xpath).clear()
|
||||||
catch e {
|
catch e {
|
||||||
if(A_index = NumOfLoops){
|
|
||||||
Return "Failed"
|
Return "Failed"
|
||||||
}
|
}
|
||||||
|
|
||||||
sleep, %SleepLength%
|
sleep, %SleepLength%
|
||||||
Continue
|
|
||||||
|
try, InerText := driver.findelementbyxpath(Xpath).Attribute("value")
|
||||||
|
; Msgbox % "InerText: " InerText
|
||||||
|
if(InerText = "")
|
||||||
|
return
|
||||||
|
|
||||||
|
if(A_index = NumberOfAttemps){
|
||||||
|
return "Failed after %NumberOfAttemps"
|
||||||
}
|
}
|
||||||
Return
|
|
||||||
|
Continue
|
||||||
|
; Return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -822,12 +850,12 @@ SaveDriverURLOFErrorPage(){ ; save the url of the result page. That way if a tab
|
|||||||
|
|
||||||
GetHTMLValueFromXpathOuterHTML(XPATH, HTMLElementName){
|
GetHTMLValueFromXpathOuterHTML(XPATH, HTMLElementName){
|
||||||
|
|
||||||
Try ElementOuterHTML := 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 Clipboard := driver.findelementbyxpath(Xpath).Attribute("outerHTML") ;XPATH-ID & Tag
|
||||||
; Try MsgBox,,Element OuterHTML: `n, % 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
|
; Match string between quotes following the HTMLELEMENTNAME
|
||||||
RegexStatement = %HTMLElementName%="([^"]+)"
|
RegexStatement = %HTMLElementName%="([^"]+)"
|
||||||
|
|
||||||
; regexMatch := RegExMatch(ElementOuterHTML, "value=""([^""]+)""", match)
|
; regexMatch := RegExMatch(ElementOuterHTML, "value=""([^""]+)""", match)
|
||||||
regexMatch := RegExMatch(ElementOuterHTML, RegexStatement, match)
|
regexMatch := RegExMatch(ElementOuterHTML, RegexStatement, match)
|
||||||
|
|||||||
41
Shared-GoTos.ahk
Normal file
41
Shared-GoTos.ahk
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
; 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, Update Available!
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if(CheckForChromeUpdates(ChromeFilepath)){
|
||||||
|
GuiControl,,ChromeUpdateAvailable, Chrome Update Available!
|
||||||
|
ChromeUpdateAvailable := 1
|
||||||
|
}
|
||||||
|
Return
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
PasteClipboardToEditBox:
|
||||||
|
if(A_GuiControl = "PasteClipboardToSMPBody"){
|
||||||
|
GuiControl,,PostBody, %Clipboard%
|
||||||
|
}
|
||||||
|
|
||||||
|
if(A_GuiControl = "PasteClipboardToSMPTitle"){
|
||||||
|
GuiControl,,PostTitle, %Clipboard%
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Return
|
||||||
24
Update-Functions.ahk
Normal file
24
Update-Functions.ahk
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
; 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, Update Available!
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if(CheckForChromeUpdates(ChromeFilepath)){
|
||||||
|
GuiControl,,ChromeUpdateAvailable, Chrome Update Available!
|
||||||
|
ChromeUpdateAvailable := 1
|
||||||
|
}
|
||||||
|
Return
|
||||||
Reference in New Issue
Block a user