small code reformatting

main
Yuriy 2 years ago
parent 968068d633
commit c206d30044

@ -3113,48 +3113,49 @@ if(Status = ""){
Return Return
;-----------------------/Steemit------------------------- ;-----------------------/Steemit-------------------------
/*
*/
;---Gettr---
;------------------------------------------------
PostToGettr:
CurrentSite := "Gettr"
;---Gettr--- SaveOrPostProgress(Message:="Navigating to Post Creation Page",PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
;------------------------------------------------ ; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
PostToGettr:
CurrentSite := "Gettr"
SaveOrPostProgress(Message:="Navigating to Post Creation Page",PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
URLAttempt := NavigateFromBaseURLTo("https://gettr.com/") URLAttempt := NavigateFromBaseURLTo("https://gettr.com/")
if(URLAttempt = "Failed") if(URLAttempt = "Failed")
Return Return
Status := CheckCurrentTabForCurrentSite() Status := CheckCurrentTabForCurrentSite()
if(Status){ if(Status){
Return Return
} }
Message = Checking Login Status Message = Checking Login Status
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
sleep, 1000 sleep, 1000
; if string in tab url, then we are logged out ; if string in tab url, then we are logged out
try CurrentTabURL := driver.Url try CurrentTabURL := driver.Url
if(InStr(CurrentTabURL, "/onboarding")) if(InStr(CurrentTabURL, "/onboarding"))
{ {
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
} }
; click input area ; click input area
; Xpath =//button[contains(text(),'Post')] ; Xpath =//button[contains(text(),'Post')]
; Xpath = ///div[@id='textarea-post'] ; Xpath = ///div[@id='textarea-post']
Xpath = //*[contains(text(),'What's new?')] Xpath = //*[contains(text(),'What's new?')]
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000) Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
; Input image ; Input image
if(ImageAttachmentFilepath != ""){ if(ImageAttachmentFilepath != ""){
; Attach image ; Attach image
Xpath = //input[@type='file'] Xpath = //input[@type='file']
@ -3171,28 +3172,28 @@ if(Status = ""){
sleep, 3000 sleep, 3000
} }
; click input area ; click input area
Xpath = //*[@id="textarea-post"] Xpath = //*[@id="textarea-post"]
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000) Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
; disable spellcheck on input field using javascript so text doesn't get garbled ; disable spellcheck on input field using javascript so text doesn't get garbled
js = document.getElementById('textarea-post').setAttribute("spellcheck", "false"); js = document.getElementById('textarea-post').setAttribute("spellcheck", "false");
try driver.executeScript(js) ;Executes a Javascript on the webpage, mostly used for buttons. try driver.executeScript(js) ;Executes a Javascript on the webpage, mostly used for buttons.
; DevModeMsgBox(JSPostTitleAndBody) ; DevModeMsgBox(JSPostTitleAndBody)
; JsToExecute = document.querySelector("#textarea-post").text = "%JSPostTitleAndBody%"; ; JsToExecute = document.querySelector("#textarea-post").text = "%JSPostTitleAndBody%";
; JsToExecute = document.getElementById('textarea-post')[0].text = "%JSPostTitleAndBody%"; ; JsToExecute = document.getElementById('textarea-post')[0].text = "%JSPostTitleAndBody%";
StrLengthOfPost := StrLen(PostTitleAndBody) StrLengthOfPost := StrLen(PostTitleAndBody)
SaveOrPostProgress(Message:="Inputting post very slow way to avoid issues with gettr's buggy text post-processing",PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:="Inputting post very slow way to avoid issues with gettr's buggy text post-processing",PostType:="Tooltip,ErrorLoggingTextFile")
Loop % StrLengthOfPost{ Loop % StrLengthOfPost{
; IndexPlusOne := A_index + 1 ; IndexPlusOne := A_index + 1
Current_Char := SubStr(PostTitleAndBody, A_index, 1) Current_Char := SubStr(PostTitleAndBody, A_index, 1)
@ -3210,84 +3211,84 @@ if(Status = ""){
} }
; sleep, 10 ; sleep, 10
; try driver.FindElementByXPath(Xpath).SendKeys(driver.Keys.Right) ; try driver.FindElementByXPath(Xpath).SendKeys(driver.Keys.Right)
} }
sleep, 500 sleep, 500
; SaveOrPostProgress(Message:="Waiting 2 seconds before submitting",PostType:="Tooltip,ErrorLoggingTextFile") ; SaveOrPostProgress(Message:="Waiting 2 seconds before submitting",PostType:="Tooltip,ErrorLoggingTextFile")
; sleep, 2000 ; sleep, 2000
SaveOrPostProgress(Message:="Submitting Post",PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:="Submitting Post",PostType:="Tooltip,ErrorLoggingTextFile")
sleep, 2000 sleep, 2000
; Click post button ; Click post button
Xpath = //span[normalize-space()='Post'] Xpath = //span[normalize-space()='Post']
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000) 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,ErrorSummaryVar")
SaveDriverURLOFErrorPage() SaveDriverURLOFErrorPage()
Return Return
} }
Message = Post Publish Successful Message = Post Publish Successful
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
IniWrite, Successful, %StatusFileFilePath%, Status, gettr IniWrite, Successful, %StatusFileFilePath%, Status, gettr
AddToTotalPostsPostedCount() AddToTotalPostsPostedCount()
PauseBetweenPosts() PauseBetweenPosts()
DevModeMsgBox("done!") DevModeMsgBox("done!")
Return Return
;---/Gettr--- ;---/Gettr---
; -------------------------------MeWe------------------------------- ; -------------------------------MeWe-------------------------------
PostToMeWe: PostToMeWe:
CurrentSite := "MeWe" CurrentSite := "MeWe"
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://www.mewe.com/myworld") URLAttempt := NavigateFromBaseURLTo("https://www.mewe.com/myworld")
if(URLAttempt = "Failed") if(URLAttempt = "Failed")
Return Return
Status := CheckCurrentTabForCurrentSite() Status := CheckCurrentTabForCurrentSite()
if(Status){ if(Status){
Return Return
} }
; Click out of try MeWe Premium popup if it appears ; Click out of try MeWe Premium popup if it appears
SaveOrPostProgress(Message:="Checking for Popups and closing them",PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:="Checking for Popups and closing them",PostType:="Tooltip,ErrorLoggingTextFile")
Xpath = //button[normalize-space()='Skip Trial'] Xpath = //button[normalize-space()='Skip Trial']
try driver.FindElementByXPath(Xpath).click() try driver.FindElementByXPath(Xpath).click()
sleep, 1000 sleep, 1000
; Click on Tell your contacts what's happening button ; Click on Tell your contacts what's happening button
SaveOrPostProgress(Message:="Clicking into Tell your Contacts.. Box",PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:="Clicking into Tell your Contacts.. Box",PostType:="Tooltip,ErrorLoggingTextFile")
Xpath = //div[@class='postbox-placeholder_text'] Xpath = //div[@class='postbox-placeholder_text']
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000) Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000)
if(Status){ if(Status){
SaveOrPostProgress(Message:="Post Failed: Check Login Status",PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") SaveOrPostProgress(Message:="Post Failed: Check Login Status",PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage() SaveDriverURLOFErrorPage()
Return Return
} }
; DevModeMsgBox("popup activated?") ; 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 /*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)

Loading…
Cancel
Save