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,40 +2540,42 @@ 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){
Status := CheckCurrentTabForCurrentSite()
if(Status){
Return
}
sleep, 1000
Message = Checking Login Status
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
}
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){
; 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
@ -2589,12 +2596,12 @@ SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
SaveDriverURLOFErrorPage()
Return
}
}
}
Message = Inputting Post
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
Message = Inputting Post
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
if(ImageAttachmentFilepath != ""){
if(ImageAttachmentFilepath != ""){
; Click the upload image button
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")
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){
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
}
}
; Click the final "post" button
SaveOrPostProgress(Message:="Submitting Post",PostType:="Tooltip,ErrorLoggingTextFile")
; 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){
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
}
}
IniWrite, Successful, %StatusFileFilePath%, Status, Gab
AddToTotalPostsPostedCount()
IniWrite, Successful, %StatusFileFilePath%, Status, Gab
AddToTotalPostsPostedCount()
SaveOrPostProgress(Message:=Message,PostType:="Tooltip")
PauseBetweenPosts()
DevModeMsgBox("done!")
SaveOrPostProgress(Message:=Message,PostType:="Tooltip")
PauseBetweenPosts()
DevModeMsgBox("done!")
Message = Submitted Successfully
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Message = Post Publish Successful
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Return
; -------------------------------/Gab-------------------------------
Return
; -------------------------------/Gab-------------------------------
; -------------------------------Bastyon-------------------------------
PostToPocketNet:
CurrentSite := "Bastyon"
; -------------------------------Bastyon-------------------------------
PostToPocketNet:
CurrentSite := "Bastyon"
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")
URLAttempt := NavigateFromBaseURLTo("https://bastyon.com/index")
if(URLAttempt = "Failed")
Return
URLAttempt := NavigateFromBaseURLTo("https://bastyon.com/index")
if(URLAttempt = "Failed")
Return
Status := CheckCurrentTabForCurrentSite()
if(Status){
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 {
}
; 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()
@ -2686,64 +2693,64 @@ SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
}
; 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
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){
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 = ""){
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
}
; 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){
; 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
@ -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