From b21b92da8749d8a9ef0d6bfe776cdb1a4ed85a24 Mon Sep 17 00:00:00 2001 From: yuriy Date: Wed, 22 Feb 2023 01:24:57 -0500 Subject: [PATCH] Removed Tumblr and pintrest code, added extra error logging to discord --- Freedomain Social Media Poster.ahk | 490 +++++++---------------------- 1 file changed, 108 insertions(+), 382 deletions(-) diff --git a/Freedomain Social Media Poster.ahk b/Freedomain Social Media Poster.ahk index 2d28868..3715d64 100644 --- a/Freedomain Social Media Poster.ahk +++ b/Freedomain Social Media Poster.ahk @@ -1572,7 +1572,7 @@ if(InStr(CurrentTabURL, "/login")){ ; SaveOrPostProgress(Message:="Posting through API",PostType:="Tooltip,ErrorLoggingTextFile") Message = Posting Through API - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") + SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") if(DiscordParlerWebhookURL = ""){ Message = Webhook Link not found. Please set "DiscordParlerWebhookURL" in %SettingsIniFilepath%. @@ -1707,7 +1707,7 @@ if(InStr(CurrentTabURL, "/login")){ 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) @@ -1892,7 +1892,7 @@ if(InStr(CurrentTabURL, "/login")){ ; SaveOrPostProgress(Message:="Posting through API",PostType:="Tooltip,ErrorLoggingTextFile") Message = Posting Through API - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") + SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") if(TelegramBotToken = "" Or TelegramBotChatID =""){ @@ -2001,6 +2001,9 @@ if(InStr(CurrentTabURL, "/login")){ Return } + SaveOrPostProgress(Message:="Navigating to Post Creation Page",PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") + + URLAttempt := NavigateFromBaseURLTo("https://www.linkedin.com/login") if(URLAttempt = "Failed") @@ -2218,7 +2221,7 @@ if(InStr(CurrentTabURL, "/login")){ 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") @@ -2457,7 +2460,7 @@ if(InStr(CurrentTabURL, "/login")){ CurrentSite := "Locals" ; DevModeMsgBox("clik ok to continue") ; @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 Message = LocalsURL from Ini File: %LocalsURL% @@ -2659,7 +2662,7 @@ if(InStr(CurrentTabURL, "/login")){ 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") @@ -2766,14 +2769,13 @@ if(InStr(CurrentTabURL, "/login")){ ; -------------------------------/Gab------------------------------- - ; -------------------------------PocketNet------------------------------- ; -------------------------------Bastyon------------------------------- PostToPocketNet: CurrentSite := "Bastyon" - SaveOrPostProgress(Message:="Navigating to Post Creation Page",PostType:="Tooltip,ErrorLoggingTextFile") - 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") @@ -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") URLAttempt := NavigateFromBaseURLTo("https://steemit.com/submit.html") @@ -3217,17 +3219,17 @@ if(InStr(CurrentTabURL, "/login")){ Return ;-----------------------/Steemit------------------------- - ;---Tumblr--- + + + ;---Gettr--- ;------------------------------------------------ - PostToTumblr: - ; Return - CurrentSite := "Tumblr" - ; msgbox + PostToGettr: + CurrentSite := "Gettr" - SaveOrPostProgress(Message:="Navigating to Post Creation Page",PostType:="Tooltip,ErrorLoggingTextFile") - 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://www.tumblr.com/new/text") + URLAttempt := NavigateFromBaseURLTo("https://gettr.com/") if(URLAttempt = "Failed") Return @@ -3236,154 +3238,130 @@ if(InStr(CurrentTabURL, "/login")){ Return } - sleep, 1000 - 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 + Message = Checking Login Status SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") + sleep, 1000 - ; Input title - Xpath = //textarea[@placeholder='Title'] - Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000,StringTextContent:=PostTitle) - if(Status){ + ; 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 } - ; Input Body of Post - Xpath = //p[@aria-label='Empty block; start writing or type forward slash to choose a block'] - Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=PostBody) - if(Status){ - Message = Failed to input Post Body - 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 != ""){ - 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) if(Status){ - Message = Failed to attach Image + Message = Failed to Attach Image SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") SaveDriverURLOFErrorPage() Return } - Message = Waiting 5 seconds for thumbnail to be generated + Message = Waiting for image to upload SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") + sleep, 3000 + - sleep, 5000 } - message = Inputting Tags - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") + ; click input area + Xpath = //*[@id="textarea-post"] + Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000) - ; Input Post Tags - TumblrTags := StrReplace(PostTags, " ", "") - TumblrTags := TumblrTags . "," - ; Msgbox % "TumblrTags: " TumblrTags - Xpath = //textarea[@placeholder='#add tags'] - Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=TumblrTags) + ; 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%"; - Message = Submitting Post - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") - ; msgbox - ; Click Submit Button - Xpath = //span[normalize-space()='Post now'] - Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000) + 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 + Message = Failed to Submit Post SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") SaveDriverURLOFErrorPage() Return } - IniWrite, Successful, %StatusFileFilePath%, Status, Tumblr + + IniWrite, Successful, %StatusFileFilePath%, Status, gettr AddToTotalPostsPostedCount() - - + PauseBetweenPosts() ; 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 != "") - PintrestURL := "https" . PintrestURL + Return - ; 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 - Return - } + ; -------------------------------MeWe------------------------------- + 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") - URLAttempt := NavigateFromBaseURLTo("https://www.pinterest.com/pin-builder/") + URLAttempt := NavigateFromBaseURLTo("https://www.mewe.com/myworld") if(URLAttempt = "Failed") Return @@ -3392,280 +3370,28 @@ if(InStr(CurrentTabURL, "/login")){ 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 - 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") + sleep, 1000 - ; Attach Thumbnail - Xpath = //input[@type='file'] - Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=ImageAttachmentFilepath) - } + ; Click on Tell your contacts what's happening button + SaveOrPostProgress(Message:="Clicking into Tell your Contacts.. Box",PostType:="Tooltip,ErrorLoggingTextFile") - Xpath = //textarea[@placeholder='Add a destination link'] - Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=PintrestURL) + Xpath = //div[@class='postbox-placeholder_text'] + Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000) if(Status){ - Message = Failed to Input Destination URL - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") + SaveOrPostProgress(Message:="Post Failed: Check Login Status",PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") SaveDriverURLOFErrorPage() Return } - ; msgbox - 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 -} -*/ - - - + ; DevModeMsgBox("popup activated?") -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!") - -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 + ; click into popup box to make sure it's activated /*xpath = //div[@class='ql-editor ql-blank']//div Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000) 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") URLAttempt := NavigateFromBaseURLTo("https://twetch.com/") @@ -3913,7 +3639,7 @@ PostToFlote: 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") @@ -4050,7 +3776,7 @@ CurrentSite := "Thinkspot" if(PostTags = ""){ 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 Return }