updated post submitted message to make error logs more readable

main
Yuriy 2 years ago
parent e627fd5453
commit 968068d633

@ -49,9 +49,12 @@ FullScriptName := ScriptName . " " . ScriptVersion
; @todo: Errorlog not getting appended to on > 1 run (ErrorLoggingFilePath) variable is missing somehwere ; @todo: Errorlog not getting appended to on > 1 run (ErrorLoggingFilePath) variable is missing somehwere
; @todo: Add tags support on all sites that support it - ask stef is useful ; @todo: Add tags support on all sites that support it - ask stef is useful
; Misc info ; Misc info
;------------------------------------------------ ;------------------------------------------------
; Parler has a 1k char limit ; Parler has a 1k char limit
; All post submits: mark with "Post Submit Successful" OR "Post Submit Failed" for easier reading of errorlogs
;---Global Variables--- ;---Global Variables---
@ -1253,7 +1256,7 @@ if(ImageAttachmentFilepath != ""){
IniWrite, Successful, %StatusFileFilePath%, Status, Discord IniWrite, Successful, %StatusFileFilePath%, Status, Discord
AddToTotalPostsPostedCount() AddToTotalPostsPostedCount()
Message = Submitted Successfully Message = Post Publish Successful
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
@ -1362,7 +1365,7 @@ TelegramBody := ASCIISTRReplace(PostBody)
IniWrite, Successful, %StatusFileFilePath%, Status, Telegram IniWrite, Successful, %StatusFileFilePath%, Status, Telegram
AddToTotalPostsPostedCount() AddToTotalPostsPostedCount()
Message = Submitted Successfully Message = Post Publish Successful
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
@ -1552,9 +1555,10 @@ if(Status){
} }
IniWrite, Successful, %StatusFileFilePath%, Status, Facebook IniWrite, Successful, %StatusFileFilePath%, Status, Facebook
AddToTotalPostsPostedCount() AddToTotalPostsPostedCount()
Message = Post Publish Successful
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
PauseBetweenPosts() PauseBetweenPosts()
@ -1886,7 +1890,7 @@ if(ImageAttachmentFilepath != ""){
PauseBetweenPosts() PauseBetweenPosts()
Message = Submitted Successfully Message = Post Publish Successful
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Return Return
@ -2117,7 +2121,7 @@ loop, 3 {
PauseBetweenPosts() PauseBetweenPosts()
DevModeMsgBox("done!") DevModeMsgBox("done!")
Message = Submitted Successfully Message = Post Publish Successful
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
@ -2364,7 +2368,7 @@ loop, 3 {
PauseBetweenPosts() PauseBetweenPosts()
DevModeMsgBox("done!") DevModeMsgBox("done!")
Message = Submitted Successfully Message = Post Publish Successful
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
@ -2493,13 +2497,14 @@ SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
try driver.executeScript(js) try driver.executeScript(js)
Message = Double checking that post got submitted Message = Double checking that post got submitted
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
sleep, 5000 sleep, 5000
try CurrentTabURL := driver.Url try CurrentTabURL := driver.Url
if(InStr(CurrentTabURL, "share/post")) { ; post failed to submit if it's still on the create new post page if(InStr(CurrentTabURL, "share/post")) { ; post failed to submit if it's still on the create new post page
Message = Error: Post Failed to Submit. Please check tab for reason. Message = Error: Post Was Input but Failed to Submit.
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage() SaveDriverURLOFErrorPage()
Return Return
@ -2527,7 +2532,7 @@ SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
PauseBetweenPosts() PauseBetweenPosts()
DevModeMsgBox("done!") DevModeMsgBox("done!")
Message = Submitted Successfully Message = Post Publish Successful
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
@ -2535,40 +2540,42 @@ SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
Return Return
; -------------------------------/Locals------------------------------- ; -------------------------------/Locals-------------------------------
/*
*/
; -------------------------------Gab------------------------------- ; -------------------------------Gab-------------------------------
PostToGab: PostToGab:
CurrentSite := "Gab" CurrentSite := "Gab"
SaveOrPostProgress(Message:="Navigating to Post Creation Page",PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:="Navigating to Post Creation Page",PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
GabPostURL = https://gab.com/compose GabPostURL = https://gab.com/compose
URLAttempt := NavigateFromBaseURLTo(GabPostURL) URLAttempt := NavigateFromBaseURLTo(GabPostURL)
if(URLAttempt = "Failed") if(URLAttempt = "Failed")
Return Return
Status := CheckCurrentTabForCurrentSite() Status := CheckCurrentTabForCurrentSite()
if(Status){ if(Status){
Return Return
} }
sleep, 1000 sleep, 1000
Message = Checking Login Status Message = Checking Login Status
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
; Message = Inputting Post ; Message = Inputting Post
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") ; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
SaveOrPostProgress(Message:="Checking Login Status",PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:="Checking Login Status",PostType:="Tooltip,ErrorLoggingTextFile")
; New post input box ; New post input box
Xpath = //div[@data-block='true']//div Xpath = //div[@data-block='true']//div
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000) Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
if(Status){ if(Status){
SaveOrPostProgress(Message:="Login Expired",PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:="Login Expired",PostType:="Tooltip,ErrorLoggingTextFile")
driver.Get("https://gab.com/auth/sign_in") ;go to login page driver.Get("https://gab.com/auth/sign_in") ;go to login page
driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding
@ -2589,12 +2596,12 @@ SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
SaveDriverURLOFErrorPage() SaveDriverURLOFErrorPage()
Return Return
} }
} }
Message = Inputting Post Message = Inputting Post
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
if(ImageAttachmentFilepath != ""){ if(ImageAttachmentFilepath != ""){
; Click the upload image button ; Click the upload image button
SaveOrPostProgress(Message:="Attaching Image First",PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:="Attaching Image First",PostType:="Tooltip,ErrorLoggingTextFile")
@ -2610,65 +2617,65 @@ SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
SaveOrPostProgress(Message:="Waiting 10 seconds for Image to finish uploading",PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:="Waiting 10 seconds for Image to finish uploading",PostType:="Tooltip,ErrorLoggingTextFile")
sleep, 10000 sleep, 10000
} }
Xpath = //div[@data-block='true']//div Xpath = //div[@data-block='true']//div
Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000) Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000)
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000,SendKeysContent:=PostTitleAndBody) Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000,SendKeysContent:=PostTitleAndBody)
if(Status){ if(Status){
SaveOrPostProgress(Message:="Login Expired. Please log back in",PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") SaveOrPostProgress(Message:="Login Expired. Please log back in",PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage() SaveDriverURLOFErrorPage()
Return Return
} }
; Click the final "post" button ; Click the final "post" button
SaveOrPostProgress(Message:="Submitting Post",PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:="Submitting Post",PostType:="Tooltip,ErrorLoggingTextFile")
Xpath = //*[@id="gabsocial"]/div/div[2]/div[2]/main/div/div[3]/div/div Xpath = //*[@id="gabsocial"]/div/div[2]/div[2]/main/div/div[3]/div/div
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=2000) Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=2000)
if(Status){ if(Status){
Message = Failed to Submit Post Message = Failed to Submit Post
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage() SaveDriverURLOFErrorPage()
Return Return
} }
IniWrite, Successful, %StatusFileFilePath%, Status, Gab IniWrite, Successful, %StatusFileFilePath%, Status, Gab
AddToTotalPostsPostedCount() AddToTotalPostsPostedCount()
SaveOrPostProgress(Message:=Message,PostType:="Tooltip") SaveOrPostProgress(Message:=Message,PostType:="Tooltip")
PauseBetweenPosts() PauseBetweenPosts()
DevModeMsgBox("done!") DevModeMsgBox("done!")
Message = Submitted Successfully Message = Post Publish Successful
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Return Return
; -------------------------------/Gab------------------------------- ; -------------------------------/Gab-------------------------------
; -------------------------------Bastyon------------------------------- ; -------------------------------Bastyon-------------------------------
PostToPocketNet: PostToPocketNet:
CurrentSite := "Bastyon" CurrentSite := "Bastyon"
SaveOrPostProgress(Message:="Navigating to Post Creation Page",PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:="Navigating to Post Creation Page",PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") ; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
URLAttempt := NavigateFromBaseURLTo("https://bastyon.com/index") URLAttempt := NavigateFromBaseURLTo("https://bastyon.com/index")
if(URLAttempt = "Failed") if(URLAttempt = "Failed")
Return Return
Status := CheckCurrentTabForCurrentSite() Status := CheckCurrentTabForCurrentSite()
if(Status){ if(Status){
Return Return
} }
; Loop a bunch of times for page to load ; Loop a bunch of times for page to load
SaveOrPostProgress(Message:="Waiting for Page to Load Fully",PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:="Waiting for Page to Load Fully",PostType:="Tooltip,ErrorLoggingTextFile")
loop, 12 { loop, 12 {
; click into input box ; click into input box
js = document.querySelector(".emojionearea-editor.pastable").click() js = document.querySelector(".emojionearea-editor.pastable").click()
@ -2686,64 +2693,64 @@ SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
} }
; Msgbox % "Status: " Status ; Msgbox % "Status: " Status
} }
if(Status){ ; if failed to click into entry box if(Status){ ; if failed to click into entry box
Message = Login Expired. Please log back in Message = Login Expired. Please log back in
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage() SaveDriverURLOFErrorPage()
Return Return
} }
Message = Clearing Previous Post Content Message = Clearing Previous Post Content
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
js = document.querySelector("div[title='Clear post'] i[class='fas fa-times-circle']").click() js = document.querySelector("div[title='Clear post'] i[class='fas fa-times-circle']").click()
try driver.executeScript(js) try driver.executeScript(js)
sleep, 1000 sleep, 1000
js = document.querySelector(".btn1.medium").click() js = document.querySelector(".btn1.medium").click()
try driver.executeScript(js) try driver.executeScript(js)
sleep, 1000 sleep, 1000
; msgbox ; msgbox
; input post text content ; input post text content
Message = Inputting Post Content Message = Inputting Post Content
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
JsToExecute = document.getElementsByClassName('emojionearea-editor pastable')[0].innerText = '%JSPostTitleAndBody%' JsToExecute = document.getElementsByClassName('emojionearea-editor pastable')[0].innerText = '%JSPostTitleAndBody%'
Status := JS_TryToExecute(JsToExecute) Status := JS_TryToExecute(JsToExecute)
if(Status){ if(Status){
Message = Post Failed: Check Login Status Message = Post Failed: Check Login Status
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage() SaveDriverURLOFErrorPage()
Return Return
} }
JsToExecute = return document.getElementsByClassName('emojionearea-editor pastable')[0].textContent; JsToExecute = return document.getElementsByClassName('emojionearea-editor pastable')[0].textContent;
try Status := driver.executeScript(JsToExecute) try Status := driver.executeScript(JsToExecute)
if(Status = ""){ if(Status = ""){
Message = Post Failed: Check Login Status Message = Post Failed: Check Login Status
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
SaveDriverURLOFErrorPage() SaveDriverURLOFErrorPage()
Return Return
} }
; Message = Post that got input: %Status% ; Message = Post that got input: %Status%
; SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile,DiscordErrorLogging") ; SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile,DiscordErrorLogging")
; DevModeMsgBox(Message) ; DevModeMsgBox(Message)
; msgbox % "textContent: " . textContent ; msgbox % "textContent: " . textContent
; Doesn't work for some reason ; Doesn't work for some reason
; JsToExecute = return document.querySelector("div.txt div.emojionearea.message div.emojionearea-editor.pastable").innerText ; JsToExecute = return document.querySelector("div.txt div.emojionearea.message div.emojionearea-editor.pastable").innerText
; Status := JS_TryToExecute(JsToExecute) ; Status := JS_TryToExecute(JsToExecute)
; if(Status){ ; if(Status){
; Message = Check Login Status: Failed to Input Post ; Message = Check Login Status: Failed to Input Post
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") ; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
; Return ; Return
@ -2904,7 +2911,7 @@ SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
PauseBetweenPosts() PauseBetweenPosts()
DevModeMsgBox("done!") DevModeMsgBox("done!")
Message = Submitted Successfully Message = Post Publish Successful
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
@ -3099,7 +3106,7 @@ SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
PauseBetweenPosts() PauseBetweenPosts()
DevModeMsgBox("done!") DevModeMsgBox("done!")
Message = Submitted Successfully Message = Post Publish Successful
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
@ -3223,6 +3230,9 @@ SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
} }
Message = Post Publish Successful
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
IniWrite, Successful, %StatusFileFilePath%, Status, gettr IniWrite, Successful, %StatusFileFilePath%, Status, gettr
AddToTotalPostsPostedCount() AddToTotalPostsPostedCount()
@ -3363,7 +3373,7 @@ PauseBetweenPosts()
DevModeMsgBox("done!") DevModeMsgBox("done!")
Message = Submitted Successfully Message = Post Publish Successful
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
@ -3516,7 +3526,7 @@ AddToTotalPostsPostedCount()
PauseBetweenPosts() PauseBetweenPosts()
DevModeMsgBox("done!") DevModeMsgBox("done!")
Message = Submitted Successfully Message = Post Publish Successful
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
@ -3671,7 +3681,7 @@ PauseBetweenPosts()
DevModeMsgBox("done!") DevModeMsgBox("done!")
Message = Submitted Successfully Message = Post Publish Successful
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
@ -3868,7 +3878,7 @@ PauseBetweenPosts()
; try driver.switchToalert().accept() ; try driver.switchToalert().accept()
DevModeMsgBox("done!") DevModeMsgBox("done!")
Message = Submitted Successfully Message = Post Publish Successful
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")

@ -1 +1 @@
Subproject commit 3f559f2f81da580263ffcc72795c30f8c89a1603 Subproject commit 9dda0e54f0ce67827b555e3c1ab931b7cec366b5
Loading…
Cancel
Save