Removed Tumblr and pintrest code, added extra error logging to discord

main
Yuriy 2 years ago
parent c1429ab2f9
commit b21b92da87

@ -1572,7 +1572,7 @@ if(InStr(CurrentTabURL, "/login")){
; SaveOrPostProgress(Message:="Posting through API",PostType:="Tooltip,ErrorLoggingTextFile") ; SaveOrPostProgress(Message:="Posting through API",PostType:="Tooltip,ErrorLoggingTextFile")
Message = Posting Through API Message = Posting Through API
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
if(DiscordParlerWebhookURL = ""){ if(DiscordParlerWebhookURL = ""){
Message = Webhook Link not found. Please set "DiscordParlerWebhookURL" in %SettingsIniFilepath%. Message = Webhook Link not found. Please set "DiscordParlerWebhookURL" in %SettingsIniFilepath%.
@ -1707,7 +1707,7 @@ if(InStr(CurrentTabURL, "/login")){
Return Return
} }
SaveOrPostProgress(Message:="Navigating to Post Creation Page",PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:="Navigating to Post Creation Page",PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Status := NavigateFromBaseURLTo(SubscribeStarProfileURL) Status := NavigateFromBaseURLTo(SubscribeStarProfileURL)
@ -1892,7 +1892,7 @@ if(InStr(CurrentTabURL, "/login")){
; SaveOrPostProgress(Message:="Posting through API",PostType:="Tooltip,ErrorLoggingTextFile") ; SaveOrPostProgress(Message:="Posting through API",PostType:="Tooltip,ErrorLoggingTextFile")
Message = Posting Through API Message = Posting Through API
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
if(TelegramBotToken = "" Or TelegramBotChatID =""){ if(TelegramBotToken = "" Or TelegramBotChatID =""){
@ -2001,6 +2001,9 @@ if(InStr(CurrentTabURL, "/login")){
Return Return
} }
SaveOrPostProgress(Message:="Navigating to Post Creation Page",PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
URLAttempt := NavigateFromBaseURLTo("https://www.linkedin.com/login") URLAttempt := NavigateFromBaseURLTo("https://www.linkedin.com/login")
if(URLAttempt = "Failed") if(URLAttempt = "Failed")
@ -2218,7 +2221,7 @@ if(InStr(CurrentTabURL, "/login")){
CurrentSite := "Minds" CurrentSite := "Minds"
SaveOrPostProgress(Message:="Navigating to Post Creation Page",PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:="Navigating to Post Creation Page",PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") ; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
@ -2457,7 +2460,7 @@ if(InStr(CurrentTabURL, "/login")){
CurrentSite := "Locals" CurrentSite := "Locals"
; DevModeMsgBox("clik ok to continue") ; DevModeMsgBox("clik ok to continue")
; @todo: Add auto-login to locals ; @todo: Add auto-login to locals
SaveOrPostProgress(Message:="Navigating to Post Creation Page",PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:="Navigating to Post Creation Page",PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
IniRead, LocalsURL, %SettingsIniFilepath%, %ScriptSettingsSection%, LocalsURL IniRead, LocalsURL, %SettingsIniFilepath%, %ScriptSettingsSection%, LocalsURL
Message = LocalsURL from Ini File: %LocalsURL% Message = LocalsURL from Ini File: %LocalsURL%
@ -2659,7 +2662,7 @@ if(InStr(CurrentTabURL, "/login")){
CurrentSite := "Gab" CurrentSite := "Gab"
SaveOrPostProgress(Message:="Navigating to Post Creation Page",PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:="Navigating to Post Creation Page",PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
@ -2766,14 +2769,13 @@ if(InStr(CurrentTabURL, "/login")){
; -------------------------------/Gab------------------------------- ; -------------------------------/Gab-------------------------------
; -------------------------------PocketNet-------------------------------
; -------------------------------Bastyon------------------------------- ; -------------------------------Bastyon-------------------------------
PostToPocketNet: PostToPocketNet:
CurrentSite := "Bastyon" CurrentSite := "Bastyon"
SaveOrPostProgress(Message:="Navigating to Post Creation Page",PostType:="Tooltip,ErrorLoggingTextFile") 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")
@ -3033,7 +3035,7 @@ if(InStr(CurrentTabURL, "/login")){
SaveOrPostProgress(Message:="Navigating to Post Creation Page",PostType:="Tooltip,ErrorLoggingTextFile") 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://steemit.com/submit.html") URLAttempt := NavigateFromBaseURLTo("https://steemit.com/submit.html")
@ -3217,17 +3219,17 @@ if(InStr(CurrentTabURL, "/login")){
Return Return
;-----------------------/Steemit------------------------- ;-----------------------/Steemit-------------------------
;---Tumblr---
;---Gettr---
;------------------------------------------------ ;------------------------------------------------
PostToTumblr: PostToGettr:
; Return CurrentSite := "Gettr"
CurrentSite := "Tumblr"
; msgbox
SaveOrPostProgress(Message:="Navigating to Post Creation Page",PostType:="Tooltip,ErrorLoggingTextFile") 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://www.tumblr.com/new/text") URLAttempt := NavigateFromBaseURLTo("https://gettr.com/")
if(URLAttempt = "Failed") if(URLAttempt = "Failed")
Return Return
@ -3236,154 +3238,130 @@ if(InStr(CurrentTabURL, "/login")){
Return Return
} }
sleep, 1000 Message = Checking Login Status
SaveOrPostProgress(Message:="Checking Login Status",PostType:="Tooltip,ErrorLoggingTextFile")
try CurrentTabURL := driver.Url
if(InStr(CurrentTabURL, "/login")){
Message = Login Cookies Expired. Trying to Re-Login
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
; sleep, 2000
Xpath = //span[normalize-space()='Log in']
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
if(Status){
SaveOrPostProgress(Message:="Failed to Login. Please Login Manually",PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding
}
Message = Inputting Post Content
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
sleep, 1000
; Input title ; if string in tab url, then we are logged out
Xpath = //textarea[@placeholder='Title'] try CurrentTabURL := driver.Url
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000,StringTextContent:=PostTitle) if(InStr(CurrentTabURL, "/onboarding"))
if(Status){ {
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
} }
; Input Body of Post ; click input area
Xpath = //p[@aria-label='Empty block; start writing or type forward slash to choose a block'] ; Xpath =//button[contains(text(),'Post')]
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=PostBody) ; Xpath = ///div[@id='textarea-post']
if(Status){ Xpath = //*[contains(text(),'What's new?')]
Message = Failed to input Post Body Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
; Input image
if(ImageAttachmentFilepath != ""){ if(ImageAttachmentFilepath != ""){
Message = Attaching Thumbnail
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
Xpath = //input[@role='button'] ; Attach image
Xpath = //input[@type='file']
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=ImageAttachmentFilepath) Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=ImageAttachmentFilepath)
if(Status){ if(Status){
Message = Failed to attach Image Message = Failed to Attach Image
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage() SaveDriverURLOFErrorPage()
Return Return
} }
Message = Waiting 5 seconds for thumbnail to be generated Message = Waiting for image to upload
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
sleep, 3000
sleep, 5000
} }
message = Inputting Tags ; click input area
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") Xpath = //*[@id="textarea-post"]
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
; Input Post Tags ; disable spellcheck on input field using javascript so text doesn't get garbled
TumblrTags := StrReplace(PostTags, " ", "") js = document.getElementById('textarea-post').setAttribute("spellcheck", "false");
TumblrTags := TumblrTags . "," try driver.executeScript(js) ;Executes a Javascript on the webpage, mostly used for buttons.
; Msgbox % "TumblrTags: " TumblrTags
Xpath = //textarea[@placeholder='#add tags']
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=TumblrTags)
; DevModeMsgBox(JSPostTitleAndBody)
; JsToExecute = document.querySelector("#textarea-post").text = "%JSPostTitleAndBody%";
; JsToExecute = document.getElementById('textarea-post')[0].text = "%JSPostTitleAndBody%";
Message = Submitting Post
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
; msgbox
; Click Submit Button StrLengthOfPost := StrLen(PostTitleAndBody)
Xpath = //span[normalize-space()='Post now']
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000) SaveOrPostProgress(Message:="Inputting post very slow way to avoid issues with gettr's buggy text post-processing",PostType:="Tooltip,ErrorLoggingTextFile")
Loop % StrLengthOfPost{
; IndexPlusOne := A_index + 1
Current_Char := SubStr(PostTitleAndBody, A_index, 1)
; SubStr(String, StartingPos [, Length])
; MsgBox % Current_Char
; Gettr_Index_Of_Line_Post := GettrPostArray[A_index]
; DevModeMsgBox(Gettr_Index_Of_Line_Post)
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=100,StringTextContent:=Current_Char)
if(Status){
Message = Failed to Input Text
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
; sleep, 10
; try driver.FindElementByXPath(Xpath).SendKeys(driver.Keys.Right)
}
sleep, 500
; SaveOrPostProgress(Message:="Waiting 2 seconds before submitting",PostType:="Tooltip,ErrorLoggingTextFile")
; sleep, 2000
SaveOrPostProgress(Message:="Submitting Post",PostType:="Tooltip,ErrorLoggingTextFile")
sleep, 2000
; Click post button
Xpath = //span[normalize-space()='Post']
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000)
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, Tumblr
IniWrite, Successful, %StatusFileFilePath%, Status, gettr
AddToTotalPostsPostedCount() AddToTotalPostsPostedCount()
PauseBetweenPosts() PauseBetweenPosts()
; TakeScreenshotOfPage() ; TakeScreenshotOfPage()
Return
;---\Tumblr---
;------------------------------------------------
;----------------Pintrest--------------------------------
PostToPintrest:
CurrentSite := "Pintrest"
PintrestPostBodyArray := StrSplit(PostBody, "https")
PintrestPostBody := PintrestPostBodyArray[1]
PintrestURL := PintrestPostBodyArray[2]
PintrestURL := StrSplit(PintrestURL, " ")
PintrestURL := PintrestURL[1]
DevModeMsgBox("done!")
if(PintrestURL != "") Return
PintrestURL := "https" . PintrestURL
; Msgbox % "PintrestURL: " PintrestURL
;---/Gettr---
; Msgbox % "PintrestPostTitleAndBody: " PintrestPostTitleAndBody
; Msgbox % "PintrestURL: " PintrestURL
; pintrest has a 500 character limit
if(StrLen(PintrestPostBody) > 499){
Message = Post longer than Pintrest's 500 character limit. Posting Skipped.
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
IniWrite, Skipped - Too Long, %StatusFileFilePath%, Status, Pintrest ; -------------------------------MeWe-------------------------------
Return PostToMeWe:
} CurrentSite := "MeWe"
if(ImageAttachmentFilepath = ""){
Message = Post Skipped, No Image attached
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
IniWrite, Skipped - No Image, %StatusFileFilePath%, Status, Pintrest
Return
}
SaveOrPostProgress(Message:="Navigating to Post Creation Page",PostType:="Tooltip,ErrorLoggingTextFile") 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://www.pinterest.com/pin-builder/") URLAttempt := NavigateFromBaseURLTo("https://www.mewe.com/myworld")
if(URLAttempt = "Failed") if(URLAttempt = "Failed")
Return Return
@ -3392,280 +3370,28 @@ if(InStr(CurrentTabURL, "/login")){
Return Return
} }
; Click out of try MeWe Premium popup if it appears
SaveOrPostProgress(Message:="Checking for Popups and closing them",PostType:="Tooltip,ErrorLoggingTextFile")
Xpath = //button[normalize-space()='Skip Trial']
try driver.FindElementByXPath(Xpath).click()
Message = Inputting Post Content sleep, 1000
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
; Input title
Xpath = //textarea[@placeholder='Add your title']
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000,StringTextContent:=PostTitle)
if(Status){
Message = Post Failed: Check Login Status
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
Xpath = //div[@role='combobox']
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=PintrestPostBody)
if(Status){
Message = Failed to input Post Body
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
if(ImageAttachmentFilepath != ""){
Message = Attaching Thumbnail
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
; Attach Thumbnail ; Click on Tell your contacts what's happening button
Xpath = //input[@type='file'] SaveOrPostProgress(Message:="Clicking into Tell your Contacts.. Box",PostType:="Tooltip,ErrorLoggingTextFile")
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=ImageAttachmentFilepath)
}
Xpath = //textarea[@placeholder='Add a destination link'] Xpath = //div[@class='postbox-placeholder_text']
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=PintrestURL) Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000)
if(Status){ if(Status){
Message = Failed to Input Destination URL SaveOrPostProgress(Message:="Post Failed: Check Login Status",PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage() SaveDriverURLOFErrorPage()
Return Return
} }
; msgbox ; DevModeMsgBox("popup activated?")
Message = Submitting Post
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
/*
OnMessage(0x44, "OnMsgBoxConfirmPost")
MsgBox 0x40040, Confirmation, Please Double Check Post Was Input and Submit It.`n`nThen click OK on this msgbox to move on to the next site.
OnMessage(0x44, "")
*/
; Click Submit Button
Xpath = //button[@data-test-id='board-dropdown-save-button']
try Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=1,SleepLength:=1000)driver.FindElementByXPath(Xpath).click()
if(Status){
Message = Failed to Submit Post
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
IniWrite, Successful, %StatusFileFilePath%, Status, Pintrest
AddToTotalPostsPostedCount()
PauseBetweenPosts()
; TakeScreenshotOfPage()
DevModeMsgBox("done!")
Return
; -------------------------------/Pintrest-------------------------------
;---Gettr---
;------------------------------------------------
PostToGettr:
CurrentSite := "Gettr"
SaveOrPostProgress(Message:="Navigating to Post Creation Page",PostType:="Tooltip,ErrorLoggingTextFile")
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
URLAttempt := NavigateFromBaseURLTo("https://gettr.com/")
if(URLAttempt = "Failed")
Return
Status := CheckCurrentTabForCurrentSite()
if(Status){
Return
}
Message = Checking Login Status
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
sleep, 1000
; if string in tab url, then we are logged out
try CurrentTabURL := driver.Url
if(InStr(CurrentTabURL, "/onboarding"))
{
Message = Login Expired. Please log back in
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
; click input area
; Xpath =//button[contains(text(),'Post')]
; Xpath = ///div[@id='textarea-post']
Xpath = //*[contains(text(),'What's new?')]
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
; Input image
if(ImageAttachmentFilepath != ""){
; Attach image
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
}
Message = Waiting for image to upload
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
sleep, 3000
}
; click input area
Xpath = //*[@id="textarea-post"]
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
; disable spellcheck on input field using javascript so text doesn't get garbled
js = document.getElementById('textarea-post').setAttribute("spellcheck", "false");
try driver.executeScript(js) ;Executes a Javascript on the webpage, mostly used for buttons.
; DevModeMsgBox(JSPostTitleAndBody)
; JsToExecute = document.querySelector("#textarea-post").text = "%JSPostTitleAndBody%";
; JsToExecute = document.getElementById('textarea-post')[0].text = "%JSPostTitleAndBody%";
/*
; 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
}
*/
/*; Xpath = //*[@id="textarea-post"]
Msgbox % "PostTitleAndBody: " PostTitleAndBody
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000,SendKeysContent:=PostTitleAndBody)
if(Status){
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
*/
StrLengthOfPost := StrLen(PostTitleAndBody)
SaveOrPostProgress(Message:="Inputting post very slow way to avoid issues with gettr's buggy text post-processing",PostType:="Tooltip,ErrorLoggingTextFile")
Loop % StrLengthOfPost{
; IndexPlusOne := A_index + 1
Current_Char := SubStr(PostTitleAndBody, A_index, 1)
; SubStr(String, StartingPos [, Length])
; MsgBox % Current_Char
; Gettr_Index_Of_Line_Post := GettrPostArray[A_index]
; DevModeMsgBox(Gettr_Index_Of_Line_Post)
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=100,StringTextContent:=Current_Char)
if(Status){
Message = Failed to Input Text
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
; sleep, 10
; try driver.FindElementByXPath(Xpath).SendKeys(driver.Keys.Right)
}
sleep, 500
; SaveOrPostProgress(Message:="Waiting 2 seconds before submitting",PostType:="Tooltip,ErrorLoggingTextFile")
; sleep, 2000
SaveOrPostProgress(Message:="Submitting Post",PostType:="Tooltip,ErrorLoggingTextFile")
sleep, 2000
; Click post button
Xpath = //span[normalize-space()='Post']
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000)
if(Status){
Message = Failed to Submit Post
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
IniWrite, Successful, %StatusFileFilePath%, Status, gettr
AddToTotalPostsPostedCount()
PauseBetweenPosts()
; TakeScreenshotOfPage()
DevModeMsgBox("done!") ; click into popup box to make sure it's activated
Return
;---/Gettr---
; -------------------------------MeWe-------------------------------
PostToMeWe:
CurrentSite := "MeWe"
SaveOrPostProgress(Message:="Navigating to Post Creation Page",PostType:="Tooltip,ErrorLoggingTextFile")
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
URLAttempt := NavigateFromBaseURLTo("https://www.mewe.com/myworld")
if(URLAttempt = "Failed")
Return
Status := CheckCurrentTabForCurrentSite()
if(Status){
Return
}
; Click out of try MeWe Premium popup if it appears
SaveOrPostProgress(Message:="Checking for Popups and closing them",PostType:="Tooltip,ErrorLoggingTextFile")
Xpath = //button[normalize-space()='Skip Trial']
try driver.FindElementByXPath(Xpath).click()
sleep, 1000
; Click on Tell your contacts what's happening button
SaveOrPostProgress(Message:="Clicking into Tell your Contacts.. Box",PostType:="Tooltip,ErrorLoggingTextFile")
Xpath = //div[@class='postbox-placeholder_text']
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000)
if(Status){
SaveOrPostProgress(Message:="Post Failed: Check Login Status",PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
; DevModeMsgBox("popup activated?")
; click into popup box to make sure it's activated
/*xpath = //div[@class='ql-editor ql-blank']//div /*xpath = //div[@class='ql-editor ql-blank']//div
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000) Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
DevModeMsgBox(Status) DevModeMsgBox(Status)
@ -3768,7 +3494,7 @@ CurrentSite := "Twetch"
; } ; }
SaveOrPostProgress(Message:="Navigating to Post Creation Page",PostType:="Tooltip,ErrorLoggingTextFile") 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://twetch.com/") URLAttempt := NavigateFromBaseURLTo("https://twetch.com/")
@ -3913,7 +3639,7 @@ PostToFlote:
CurrentSite := "Flote" CurrentSite := "Flote"
SaveOrPostProgress(Message:="Navigating to Post Creation Page",PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:="Navigating to Post Creation Page",PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") ; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
@ -4050,7 +3776,7 @@ CurrentSite := "Thinkspot"
if(PostTags = ""){ if(PostTags = ""){
Message = Skipped: No Post Tags Message = Skipped: No Post Tags
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
IniWrite, Skipped: No Post Tags, %StatusFileFilePath%, Status, Thinkspot IniWrite, Skipped: No Post Tags, %StatusFileFilePath%, Status, Thinkspot
Return Return
} }

Loading…
Cancel
Save