|
|
|
|
|
|
|
; -------------------------------Locals-------------------------------
|
|
|
|
PostToLocals:
|
|
|
|
CurrentSite := "Locals"
|
|
|
|
; DevModeMsgBox("clik ok to continue")
|
|
|
|
; @todo: Add auto-login to locals
|
|
|
|
SaveOrPostProgress(Message:="Navigating to Post Creation Page",PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
|
|
|
|
|
|
|
|
|
|
|
IniRead, LocalsURL, %SettingsIniFilepath%, %ScriptSettingsSection%, LocalsURL, %A_Space%
|
|
|
|
if(LocalsURL = "" OR !InStr(LocalsURL, "/share/post")){
|
|
|
|
Message = Please add your Locals Profile URL to the settings.ini file under`n`n[General]`nLocalsURL=`n`nURL Needs to end in: /share/post
|
|
|
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
|
|
|
Return
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Status := NavigateFromBaseURLTo(LocalsURL)
|
|
|
|
if(Status = "Failed")
|
|
|
|
Return
|
|
|
|
|
|
|
|
Status := CheckCurrentTabForCurrentSite()
|
|
|
|
if(Status){
|
|
|
|
Return
|
|
|
|
}
|
|
|
|
sleep, 1000
|
|
|
|
|
|
|
|
Message = Checking Login Status
|
|
|
|
|
|
|
|
try CurrentTabURL := driver.Url
|
|
|
|
if(InStr(CurrentTabURL, "/login") OR InStr(CurrentTabURL, "/register")){
|
|
|
|
Message = Login Expired. Please log back in
|
|
|
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
|
|
|
SaveDriverURLOFErrorPage()
|
|
|
|
Return
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Message = Inputting Post Content
|
|
|
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
|
|
|
|
|
|
|
|
|
|
|
Xpath = //*[@id="body"]
|
|
|
|
try driver.FindElementByXPath(Xpath).click()
|
|
|
|
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=PostTitleAndBody)
|
|
|
|
if(Status){
|
|
|
|
Message = Failed to input Title
|
|
|
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
|
|
|
SaveDriverURLOFErrorPage()
|
|
|
|
Return
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(ImageAttachmentFilepath != ""){
|
|
|
|
; Click the upload image button
|
|
|
|
SaveOrPostProgress(Message:="Attaching Image",PostType:="Tooltip,ErrorLoggingTextFile")
|
|
|
|
|
|
|
|
|
|
|
|
Xpath = //input[@multiple='multiple']
|
|
|
|
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=ImageAttachmentFilepath)
|
|
|
|
if(Status){
|
|
|
|
Message = Failed to Upload Image
|
|
|
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
|
|
|
SaveDriverURLOFErrorPage()
|
|
|
|
Return
|
|
|
|
}
|
|
|
|
; driver.FindElementByXPath(Xpath).SendKeys(ImageAttachmentFilepath)
|
|
|
|
; driver.FindElementByXPath(Xpath).SendKeys(ImageAttachmentFilepath)
|
|
|
|
|
|
|
|
|
|
|
|
SaveOrPostProgress(Message:="Waiting 10 seconds for Image to finish uploading",PostType:="Tooltip,ErrorLoggingTextFile")
|
|
|
|
|
|
|
|
sleep, 10000
|
|
|
|
}
|
|
|
|
Message = Submitting Post
|
|
|
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* ; Click the final "post" button
|
|
|
|
SaveOrPostProgress(Message:="Submitting Post",PostType:="Tooltip,ErrorLoggingTextFile")
|
|
|
|
Status := Selenium_LoopToClickName(ElementName:="submitPost",NumOfLoops:=5,SleepLength:=1000)
|
|
|
|
if(Status){
|
|
|
|
Message = Failed to Submit Post
|
|
|
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
|
|
|
Return
|
|
|
|
}
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
; msgbox
|
|
|
|
|
|
|
|
; @todo: add error check into here to check the current page url and after page url
|
|
|
|
; Click Publish post
|
|
|
|
js = document.getElementsByName('submitPost')[0].click(); ; Send content through javascript (Great for getting around emoji chrome limitaitons)
|
|
|
|
try driver.executeScript(js)
|
|
|
|
|
|
|
|
Message = Double checking that post got submitted
|
|
|
|
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 Was Input but Failed to Submit.
|
|
|
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
|
|
|
SaveDriverURLOFErrorPage()
|
|
|
|
Return
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ; Double check that post got submitted
|
|
|
|
js = return document.querySelector("#body").value
|
|
|
|
Status := driver.executeScript(js)
|
|
|
|
if(Status != ""){
|
|
|
|
Message = Error: Post Failed to Submit for some reason
|
|
|
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
|
|
|
SaveDriverURLOFErrorPage()
|
|
|
|
Return
|
|
|
|
}
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
IniWrite, Successful, %StatusFileFilePath%, Status, Locals
|
|
|
|
AddToTotalPostsPostedCount()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip")
|
|
|
|
PauseBetweenPosts()
|
|
|
|
DevModeMsgBox("done!")
|
|
|
|
|
|
|
|
Message = Post Publish Successful
|
|
|
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Return
|
|
|
|
; -------------------------------/Locals-------------------------------
|