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: Add tags support on all sites that support it - ask stef is useful
; Misc info
;------------------------------------------------
; 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---
@ -1253,7 +1256,7 @@ if(ImageAttachmentFilepath != ""){
IniWrite, Successful, %StatusFileFilePath%, Status, Discord
AddToTotalPostsPostedCount()
Message = Submitted Successfully
Message = Post Publish Successful
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
@ -1362,7 +1365,7 @@ TelegramBody := ASCIISTRReplace(PostBody)
IniWrite, Successful, %StatusFileFilePath%, Status, Telegram
AddToTotalPostsPostedCount()
Message = Submitted Successfully
Message = Post Publish Successful
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
@ -1552,9 +1555,10 @@ if(Status){
}
IniWrite, Successful, %StatusFileFilePath%, Status, Facebook
AddToTotalPostsPostedCount()
Message = Post Publish Successful
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
PauseBetweenPosts()
@ -1886,7 +1890,7 @@ if(ImageAttachmentFilepath != ""){
PauseBetweenPosts()
Message = Submitted Successfully
Message = Post Publish Successful
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Return
@ -2117,7 +2121,7 @@ loop, 3 {
PauseBetweenPosts()
DevModeMsgBox("done!")
Message = Submitted Successfully
Message = Post Publish Successful
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
@ -2364,7 +2368,7 @@ loop, 3 {
PauseBetweenPosts()
DevModeMsgBox("done!")
Message = Submitted Successfully
Message = Post Publish Successful
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
@ -2493,13 +2497,14 @@ SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
try driver.executeScript(js)
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
try CurrentTabURL := driver.Url
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")
SaveDriverURLOFErrorPage()
Return
@ -2527,7 +2532,7 @@ SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
PauseBetweenPosts()
DevModeMsgBox("done!")
Message = Submitted Successfully
Message = Post Publish Successful
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
@ -2535,229 +2540,231 @@ SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
Return
; -------------------------------/Locals-------------------------------
/*
*/
; -------------------------------Gab-------------------------------
PostToGab:
CurrentSite := "Gab"
; -------------------------------Gab-------------------------------
PostToGab:
CurrentSite := "Gab"
SaveOrPostProgress(Message:="Navigating to Post Creation Page",PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
SaveOrPostProgress(Message:="Navigating to Post Creation Page",PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
GabPostURL = https://gab.com/compose
URLAttempt := NavigateFromBaseURLTo(GabPostURL)
if(URLAttempt = "Failed")
Return
GabPostURL = https://gab.com/compose
URLAttempt := NavigateFromBaseURLTo(GabPostURL)
if(URLAttempt = "Failed")
Return
Status := CheckCurrentTabForCurrentSite()
if(Status){
Return
}
sleep, 1000
Message = Checking Login Status
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
Status := CheckCurrentTabForCurrentSite()
if(Status){
Return
}
sleep, 1000
Message = Checking Login Status
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
; Message = Inputting Post
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
; Message = Inputting Post
; 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
Xpath = //div[@data-block='true']//div
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
if(Status){
SaveOrPostProgress(Message:="Login Expired",PostType:="Tooltip,ErrorLoggingTextFile")
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
; New post input box
Xpath = //div[@data-block='true']//div
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
if(Status){
SaveOrPostProgress(Message:="Login Expired",PostType:="Tooltip,ErrorLoggingTextFile")
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
if(AutoLogin){
SaveOrPostProgress(Message:="Checking if chrome input email address",PostType:="Tooltip,ErrorLoggingTextFile")
js = return document.querySelector("#user_email").value;
if(AutoLogin){
SaveOrPostProgress(Message:="Checking if chrome input email address",PostType:="Tooltip,ErrorLoggingTextFile")
js = return document.querySelector("#user_email").value;
status := driver.executeScript(js)
if(StrLen(Status) > 0){
SaveOrPostProgress(Message:="Clicking Login Button",PostType:="Tooltip,ErrorLoggingTextFile")
js = document.querySelector("button[name='button']").click()
status := driver.executeScript(js)
if(StrLen(Status) > 0){
SaveOrPostProgress(Message:="Clicking Login Button",PostType:="Tooltip,ErrorLoggingTextFile")
js = document.querySelector("button[name='button']").click()
status := driver.executeScript(js)
return
}
}
else, {
SaveOrPostProgress(Message:="Login Expired. Please log back in",PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
}
Message = Inputting Post
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
if(ImageAttachmentFilepath != ""){
; Click the upload image button
SaveOrPostProgress(Message:="Attaching Image First",PostType:="Tooltip,ErrorLoggingTextFile")
Xpath = //input[@type='file']
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=ImageAttachmentFilepath)
if(Status){
Message = Failed to attach Image
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
return
}
SaveOrPostProgress(Message:="Waiting 10 seconds for Image to finish uploading",PostType:="Tooltip,ErrorLoggingTextFile")
sleep, 10000
}
Xpath = //div[@data-block='true']//div
Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000)
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000,SendKeysContent:=PostTitleAndBody)
if(Status){
else, {
SaveOrPostProgress(Message:="Login Expired. Please log back in",PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
}
Message = Inputting Post
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
; Click the final "post" button
SaveOrPostProgress(Message:="Submitting Post",PostType:="Tooltip,ErrorLoggingTextFile")
if(ImageAttachmentFilepath != ""){
; Click the upload image button
SaveOrPostProgress(Message:="Attaching Image First",PostType:="Tooltip,ErrorLoggingTextFile")
Xpath = //*[@id="gabsocial"]/div/div[2]/div[2]/main/div/div[3]/div/div
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=2000)
Xpath = //input[@type='file']
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=ImageAttachmentFilepath)
if(Status){
Message = Failed to Submit Post
Message = Failed to attach Image
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
IniWrite, Successful, %StatusFileFilePath%, Status, Gab
AddToTotalPostsPostedCount()
SaveOrPostProgress(Message:="Waiting 10 seconds for Image to finish uploading",PostType:="Tooltip,ErrorLoggingTextFile")
SaveOrPostProgress(Message:=Message,PostType:="Tooltip")
PauseBetweenPosts()
DevModeMsgBox("done!")
sleep, 10000
}
Xpath = //div[@data-block='true']//div
Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000)
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000,SendKeysContent:=PostTitleAndBody)
if(Status){
SaveOrPostProgress(Message:="Login Expired. Please log back in",PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
Message = Submitted Successfully
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
; Click the final "post" button
SaveOrPostProgress(Message:="Submitting Post",PostType:="Tooltip,ErrorLoggingTextFile")
Xpath = //*[@id="gabsocial"]/div/div[2]/div[2]/main/div/div[3]/div/div
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=2000)
if(Status){
Message = Failed to Submit Post
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
; -------------------------------/Gab-------------------------------
}
IniWrite, Successful, %StatusFileFilePath%, Status, Gab
AddToTotalPostsPostedCount()
; -------------------------------Bastyon-------------------------------
PostToPocketNet:
CurrentSite := "Bastyon"
SaveOrPostProgress(Message:="Navigating to Post Creation Page",PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
SaveOrPostProgress(Message:=Message,PostType:="Tooltip")
PauseBetweenPosts()
DevModeMsgBox("done!")
URLAttempt := NavigateFromBaseURLTo("https://bastyon.com/index")
if(URLAttempt = "Failed")
Return
Message = Post Publish Successful
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Status := CheckCurrentTabForCurrentSite()
if(Status){
Return
}
; Loop a bunch of times for page to load
SaveOrPostProgress(Message:="Waiting for Page to Load Fully",PostType:="Tooltip,ErrorLoggingTextFile")
loop, 12 {
Return
; -------------------------------/Gab-------------------------------
; click into input box
js = document.querySelector(".emojionearea-editor.pastable").click()
try driver.executeScript(js)
Xpath = //div[@class='emojionearea-editor pastable']
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=1,SleepLength:=5000)
if(!Status)
break
; -------------------------------Bastyon-------------------------------
PostToPocketNet:
CurrentSite := "Bastyon"
Xpath = //b[normalize-space()='Sign in']
try Status := driver.findelementbyxpath(Xpath).Attribute("textContent") ;XPath: ID=site-title & span tag
if(InStr(Status, "Sign in")){
break
}
; Msgbox % "Status: " Status
}
if(Status){ ; if failed to click into entry box
Message = Login Expired. Please log back in
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
SaveOrPostProgress(Message:="Navigating to Post Creation Page",PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
URLAttempt := NavigateFromBaseURLTo("https://bastyon.com/index")
if(URLAttempt = "Failed")
Return
Status := CheckCurrentTabForCurrentSite()
if(Status){
Return
}
; Loop a bunch of times for page to load
SaveOrPostProgress(Message:="Waiting for Page to Load Fully",PostType:="Tooltip,ErrorLoggingTextFile")
loop, 12 {
; click into input box
js = document.querySelector(".emojionearea-editor.pastable").click()
try driver.executeScript(js)
Xpath = //div[@class='emojionearea-editor pastable']
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=1,SleepLength:=5000)
if(!Status)
break
Xpath = //b[normalize-space()='Sign in']
try Status := driver.findelementbyxpath(Xpath).Attribute("textContent") ;XPath: ID=site-title & span tag
if(InStr(Status, "Sign in")){
break
}
; Msgbox % "Status: " Status
}
if(Status){ ; if failed to click into entry box
Message = Login Expired. Please log back in
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
Message = Clearing Previous Post Content
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
Message = Clearing Previous Post Content
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
js = document.querySelector("div[title='Clear post'] i[class='fas fa-times-circle']").click()
try driver.executeScript(js)
js = document.querySelector("div[title='Clear post'] i[class='fas fa-times-circle']").click()
try driver.executeScript(js)
sleep, 1000
sleep, 1000
js = document.querySelector(".btn1.medium").click()
try driver.executeScript(js)
js = document.querySelector(".btn1.medium").click()
try driver.executeScript(js)
sleep, 1000
sleep, 1000
; msgbox
; msgbox
; input post text content
Message = Inputting Post Content
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
; input post text content
Message = Inputting Post Content
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
JsToExecute = document.getElementsByClassName('emojionearea-editor pastable')[0].innerText = '%JSPostTitleAndBody%'
Status := JS_TryToExecute(JsToExecute)
if(Status){
Message = Post Failed: Check Login Status
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
JsToExecute = document.getElementsByClassName('emojionearea-editor pastable')[0].innerText = '%JSPostTitleAndBody%'
Status := JS_TryToExecute(JsToExecute)
if(Status){
Message = Post Failed: Check Login Status
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
JsToExecute = return document.getElementsByClassName('emojionearea-editor pastable')[0].textContent;
try Status := driver.executeScript(JsToExecute)
if(Status = ""){
Message = Post Failed: Check Login Status
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
; Message = Post that got input: %Status%
; SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile,DiscordErrorLogging")
; DevModeMsgBox(Message)
; msgbox % "textContent: " . textContent
JsToExecute = return document.getElementsByClassName('emojionearea-editor pastable')[0].textContent;
try Status := driver.executeScript(JsToExecute)
if(Status = ""){
Message = Post Failed: Check Login Status
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
; Message = Post that got input: %Status%
; SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile,DiscordErrorLogging")
; DevModeMsgBox(Message)
; msgbox % "textContent: " . textContent
; Doesn't work for some reason
; JsToExecute = return document.querySelector("div.txt div.emojionearea.message div.emojionearea-editor.pastable").innerText
; Status := JS_TryToExecute(JsToExecute)
; if(Status){
; Message = Check Login Status: Failed to Input Post
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
; Return
; }
; Doesn't work for some reason
; JsToExecute = return document.querySelector("div.txt div.emojionearea.message div.emojionearea-editor.pastable").innerText
; Status := JS_TryToExecute(JsToExecute)
; if(Status){
; Message = Check Login Status: Failed to Input Post
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
; Return
; }
sleep, 2000
sleep, 2000
if(ImageAttachmentFilepath != ""){
; Message = Attaching Image
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip")
if(ImageAttachmentFilepath != ""){
; Message = Attaching Image
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip")
; Click the "Image" button
SaveOrPostProgress(Message:="Attaching Image",PostType:="Tooltip,ErrorLoggingTextFile")
; Click the "Image" button
SaveOrPostProgress(Message:="Attaching Image",PostType:="Tooltip,ErrorLoggingTextFile")
/* Xpath = //div[@title='Add Images to Post']
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
if(Status){
@ -2904,7 +2911,7 @@ SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
PauseBetweenPosts()
DevModeMsgBox("done!")
Message = Submitted Successfully
Message = Post Publish Successful
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
@ -3099,7 +3106,7 @@ SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
PauseBetweenPosts()
DevModeMsgBox("done!")
Message = Submitted Successfully
Message = Post Publish Successful
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
AddToTotalPostsPostedCount()
@ -3363,7 +3373,7 @@ PauseBetweenPosts()
DevModeMsgBox("done!")
Message = Submitted Successfully
Message = Post Publish Successful
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
@ -3516,7 +3526,7 @@ AddToTotalPostsPostedCount()
PauseBetweenPosts()
DevModeMsgBox("done!")
Message = Submitted Successfully
Message = Post Publish Successful
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
@ -3671,7 +3681,7 @@ PauseBetweenPosts()
DevModeMsgBox("done!")
Message = Submitted Successfully
Message = Post Publish Successful
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
@ -3868,7 +3878,7 @@ PauseBetweenPosts()
; try driver.switchToalert().accept()
DevModeMsgBox("done!")
Message = Submitted Successfully
Message = Post Publish Successful
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")

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