updated shared functions submodule and added Locals URL check and version bump
This commit is contained in:
@@ -40,7 +40,7 @@ global UpdateVersionNumber
|
||||
|
||||
|
||||
ScriptName = Freedomain Social Media Poster
|
||||
ScriptVersion = 2.76
|
||||
ScriptVersion = 2.77
|
||||
FullScriptName := ScriptName . " " . ScriptVersion
|
||||
|
||||
;---ToDo---
|
||||
@@ -2378,6 +2378,7 @@ CurrentSite := "Locals"
|
||||
; @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 = ""){
|
||||
Message = Please add your Locals Profile URL to the settings.ini file under`n`n[General]`nLocalsURL=
|
||||
@@ -2385,8 +2386,18 @@ if(LocalsURL = ""){
|
||||
Return
|
||||
}
|
||||
|
||||
; Message = LocalsURL from Ini File: %LocalsURL%
|
||||
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
|
||||
Message = LocalsURL from Ini File: %LocalsURL%
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
|
||||
if(!InStr(LocalsURL, "/share/post")){
|
||||
LocalsURL = https://freedomain.locals.com/share/post
|
||||
|
||||
Message = LocalsURL from ini file was incorrect. New URL set to %LocalsURL% and saved to settings.ini
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
|
||||
IniWrite, %LocalsURL%, %SettingsIniFilepath%, %ScriptSettingsSection%, LocalsURL
|
||||
}
|
||||
|
||||
; LocalsURL := StrReplace(Localsurl, "/share/post", "")
|
||||
; LocalsURL := Localsurl . "/login"
|
||||
@@ -2413,109 +2424,49 @@ if(InStr(CurrentTabURL, "/login") OR InStr(CurrentTabURL, "/register")){
|
||||
Return
|
||||
}
|
||||
|
||||
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
; Xpath = //textarea[@id='body']
|
||||
; Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=2000)
|
||||
; if(Status){
|
||||
; Message = Trying to Log Back In
|
||||
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
|
||||
; LocalsLoginURL := LocalsURL . "/login"
|
||||
; try driver.Get(LocalsLoginURL) ;Open selected URL
|
||||
; try driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding
|
||||
|
||||
; sleep, 3000
|
||||
; js = document.getElementsByName('submit')[0].click();
|
||||
; try driver.executeScript(js)
|
||||
; ; DevModeMsgBox(js)
|
||||
; ; clipboard := js
|
||||
|
||||
; try driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding
|
||||
; sleep, 5000
|
||||
; ; try driver.Get(LocalsURL) ;Open selected URL
|
||||
; ; try driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding
|
||||
|
||||
; Xpath = //textarea[@id='body']
|
||||
; Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=2000)
|
||||
; {
|
||||
; Message = Post Failed: Check Login Status
|
||||
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||
; Return
|
||||
; }
|
||||
|
||||
/* Message = Post Failed: Check Login Status
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||
SaveDriverURLOFErrorPage()
|
||||
Return
|
||||
|
||||
Message = Page did not load after 30 seconds. Force stopping refresh and trying to continue
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
|
||||
send, {Escape} ; Temporary workaround, as Page seems to endlessly load for Stef
|
||||
|
||||
Xpath = //textarea[@id='body']
|
||||
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
|
||||
if(Status){
|
||||
SaveOrPostProgress(Message:="Post Failed: Check Login Status",PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||
|
||||
|
||||
Return
|
||||
}
|
||||
*/
|
||||
|
||||
; }
|
||||
Message = Inputting Post Content
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
; sleep, 1000
|
||||
|
||||
/* Xpath = //textarea[@id='body']
|
||||
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000,StringTextContent:=PostBody)
|
||||
if(Status){
|
||||
Message = Failed to Input Post Body
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
SaveDriverURLOFErrorPage()
|
||||
Return
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
if(ImageAttachmentFilepath != ""){
|
||||
; Click the upload image button
|
||||
SaveOrPostProgress(Message:="Attaching Image",PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
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)
|
||||
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")
|
||||
SaveOrPostProgress(Message:="Waiting 10 seconds for Image to finish uploading",PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
|
||||
sleep, 10000
|
||||
}
|
||||
Message = Submitting Post
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
sleep, 10000
|
||||
}
|
||||
Message = Submitting Post
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user