@ -40,7 +40,7 @@ global UpdateVersionNumber
ScriptName = Freedomain Social Media Poster
ScriptName = Freedomain Social Media Poster
ScriptVersion = 2.75
ScriptVersion = 2.76
FullScriptName := ScriptName . " " . ScriptVersion
FullScriptName := ScriptName . " " . ScriptVersion
;---ToDo---
;---ToDo---
@ -1561,6 +1561,8 @@ Return
;---------------/Facebook----------------------------------
;---------------/Facebook----------------------------------
/*
*/
; -------------------------------Parler-------------------------------
; -------------------------------Parler-------------------------------
PostToParler:
PostToParler:
@ -1887,178 +1889,179 @@ if(ImageAttachmentFilepath != ""){
Return
Return
; -------------------------------/SubScribeStar-------------------------------
; -------------------------------/SubScribeStar-------------------------------
/*
*/
; -------------------------------LinkedIn-------------------------------
PostToLinkedIN:
CurrentSite := "LinkedIn"
; -------------------------------LinkedIn-------------------------------
if(StrLen(PostTitleAndBody) > 1300){
PostToLinkedIN:
Message = Post longer than LinkedIn's 1300 character limit. Posting Skipped.
CurrentSite := "LinkedIn"
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
if(StrLen(PostTitleAndBody) > 1300){
IniWrite, Skipped - Too Long, %StatusFileFilePath%, Status, LinkedIn
Message = Post longer than LinkedIn's 1300 character limit. Posting Skipped.
Return
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
}
IniWrite, Skipped - Too Long, %StatusFileFilePath%, Status, LinkedIn
SaveOrPostProgress(Message:="Navigating to Post Creation Page",PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Return
}
SaveOrPostProgress(Message:="Navigating to Post Creation Page",PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
URLAttempt := NavigateFromBaseURLTo("https://www.linkedin.com/login")
if(URLAttempt = "Failed")
Return
URLAttempt := NavigateFromBaseURLTo("https://www.linkedin.com/login")
Status := CheckCurrentTabForCurrentSite( )
if(URLAttempt = "Failed")
if(Status){
Return
Return
}
Status := CheckCurrentTabForCurrentSite()
Message = Checking Login Status
if(Status){
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
Return
}
Message = Checking Login Status
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
sleep, 1000
sleep, 1000
try CurrentTabURL := driver.Url
try CurrentTabURL := driver.Url
if(InStr(CurrentTabURL, "login")){
if(InStr(CurrentTabURL, "login")){
Message = Login Expired. Please log back in
Message = Login Expired. Please log back in
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
SaveDriverURLOFErrorPage()
Return
Return
}
}
Message = Clicking "Start a Post" button
Message = Clicking "Start a Post" button
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
loop, 3 {
loop, 3 {
Xpath = (//span[normalize-space()='Start a post'])[1] ; start a post button
Xpath = (//span[normalize-space()='Start a post'])[1] ; start a post button
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
if(!Status)
if(!Status)
Break
Break
; Msgbox % "Status: " Status
; Msgbox % "Status: " Status
if(Status AND A_index = 1){
if(Status AND A_index = 1){
try CurrentURL := driver.url
try CurrentURL := driver.url
Message = Failed to click on "Start a post" button`nChecking Login Status`nCurrent URL: %CurrentURL%
Message = Failed to click on "Start a post" button`nChecking Login Status`nCurrent URL: %CurrentURL%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
try html := driver.pagesource ; save page's entire HTML to a variable
if(InStr(HTML, "Sign In") AND InStr(HTML, "Forgot password")){
Xpath = //button[normalize-space()='Sign in']
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding
sleep, 2000
driver.Get("https://www.linkedin.com/feed/") ;Open selected URL
; driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding
continue
}
else, ; otherwise check and toggle the chat popup on the side
{
Message = Checking if Chat Sidebar is in the way
SaveOrPostProgress(Message:=Message,PostType:="Tooltip")
try html := driver.pagesource ; save page's entire HTML to a variable
try html := driver.pagesource ; save page's entire HTML to a variable
if(InStr(HTML, "Sign In") AND InStr(HTML, "Forgot password")){
if(InStr(HTML,"You are on the messaging overlay. Press enter to minimize it.")){ ; if sidebar is open
Xpath = //button[normalize-space()='Sign in']
Xpath = //body//div//aside//button[2] ; click to minimize it
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
try driver.FindElementByXPath(Xpath).click()
driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding
Message = Chat sidebar was minimized
sleep, 2000
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
driver.Get("https://www.linkedin.com/feed/") ;Open selected URL
Continue ; continue to next loop
; driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding
continue
}
else, ; otherwise check and toggle the chat popup on the side
{
Message = Checking if Chat Sidebar is in the way
SaveOrPostProgress(Message:=Message,PostType:="Tooltip")
try html := driver.pagesource ; save page's entire HTML to a variable
if(InStr(HTML,"You are on the messaging overlay. Press enter to minimize it.")){ ; if sidebar is open
Xpath = //body//div//aside//button[2] ; click to minimize it
try driver.FindElementByXPath(Xpath).click()
Message = Chat sidebar was minimized
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Continue ; continue to next loop
}
}
}
}
}
; DevModeMsgBox("test")
; Check if linked in post popup appeared
Xpath = //div[@aria-label='Text editor for creating content']
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
if(Status){
Message = Failed to click into Create Post popup to input post
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
}
}
}
; DevModeMsgBox("test")
; Check if linked in post popup appeared
Xpath = //div[@aria-label='Text editor for creating content']
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
if(Status){
if(Status){
Message = Login Expired. Please log back in
Message = Failed to click into Create Post popup to input post
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Return
}
}
}
if(ImageAttachmentFilepath != ""){
if(Status){
; Click the upload image button
Message = Login Expired. Please log back in
SaveOrPostProgress(Message:="Attaching Image",PostType:="Tooltip,ErrorLoggingTextFile")
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return
; click attach image button
}
Xpath = //li-icon[@type='image']//*[name()='svg']
Status := Selenium_LoopToClickXpathAndWaitForOpenWindow(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000)
if(Status){
Message = Failed to click "Attach Image" button with Selenium
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Xpath = //input[@id='image-sharing-detour-container__file-input']
if(ImageAttachmentFilepath != ""){
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=ImageAttachmentFilepath)
; Click the upload image button
if(Status){
SaveOrPostProgress(Message:="Attaching Image",PostType:="Tooltip,ErrorLoggingTextFile")
Message = Failed to Attach photo with both attempts.
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
if(WinExist("Open")) ; if open image popup still exists, close it
; click attach image button
WinClose, Open
Xpath = //li-icon[@type='image']//*[name()='svg']
; Return
Status := Selenium_LoopToClickXpathAndWaitForOpenWindow(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000)
}
if(Status){
else, {
Message = Failed to click "Attach Image" button with Selenium
Status := InputFilePathIntoOpenWindow(ImageAttachmentFilepath)
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
if(Status)
{
Message = Failed to input filepath into "Open File" window.
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
}
; sleep, 10000
Xpath = //span[normalize-space()='Done'] ; click done button
Xpath = //input[@id='image-sharing-detour-container__file-input']
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=10,SleepLength:=1000 )
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=ImageAttachmentFilepath)
if(Status){
if(Status){
Message = Failed to click "Done" button on image upload
Message = Failed to Attach photo with both attempts.
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
SaveDriverURLOFErrorPage()
Return
Return
}
}
SaveOrPostProgress(Message:="Waiting 5 seconds for Image to finish uploading",PostType:="Tooltip,ErrorLoggingTextFile")
if(WinExist("Open")) ; if open image popup still exists, close it
sleep, 5000
WinClose, Open
; Return
}
else, {
Status := InputFilePathIntoOpenWindow(ImageAttachmentFilepath)
if(Status)
{
Message = Failed to input filepath into "Open File" window.
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
}
; sleep, 10000
Xpath = //span[normalize-space()='Done'] ; click done button
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=10,SleepLength:=1000)
if(Status){
Message = Failed to click "Done" button on image upload
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
}
Message = Inputting Post
SaveOrPostProgress(Message:="Waiting 5 seconds for Image to finish uploading",PostType:="Tooltip,ErrorLoggingTextFile")
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
sleep, 5000
; Input Post text contents
}
loop, 3 {
Xpath = //div[@aria-label='Text editor for creating content'] ; Input text of post
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000,StringTextContent:=PostTitleAndBody)
if(Status){
Message = Failed to input post content
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
}
; Double check that post got input
Message = Inputting Post
Jscheck = return document.querySelector("div[aria-label='Text editor for creating content']").innerText
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
try Status := driver.executeScript(Jscheck)
; DevModeMsgBox(Status)
if(StrLen(Status) > 5)
Break
if(A_index = 3){
; Input Post text contents
Message = Post Failed: Failed to input Post for some reason
loop, 3 {
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Xpath = //div[@aria-label='Text editor for creating content'] ; Input text of post
SaveDriverURLOFErrorPage()
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000,StringTextContent:=PostTitleAndBody)
Return
if(Status){
}
Message = Failed to input post content
; Continue
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
}
; Double check that post got input
Jscheck = return document.querySelector("div[aria-label='Text editor for creating content']").innerText
try Status := driver.executeScript(Jscheck)
; DevModeMsgBox(Status)
if(StrLen(Status) > 5)
Break
if(A_index = 3){
Message = Post Failed: Failed to input Post for some reason
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
}
; Continue
}
/* if(!Status){ ; if BLANK
/* if(!Status){ ; if BLANK
Message = Post Failed: Failed to input Post for some reason
Message = Post Failed: Failed to input Post for some reason
@ -2118,212 +2121,216 @@ if(ImageAttachmentFilepath != ""){
Return
Return
; -------------------------------/LinkedIn-------------------------------
; -------------------------------/LinkedIn-------------------------------
/*
*/
; -------------------------------Minds-------------------------------
; -------------------------------Minds-------------------------------
PostToMinds:
PostToMinds:
CurrentSite := "Minds"
CurrentSite := "Minds"
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.minds.com/newsfeed/subscriptions")
URLAttempt := NavigateFromBaseURLTo("https://www.minds.com/newsfeed/subscriptions")
if(URLAttempt = "Failed")
if(URLAttempt = "Failed")
Return
Status := CheckCurrentTabForCurrentSite()
if(Status){
Return
Return
}
Status := CheckCurrentTabForCurrentSite()
sleep, 1000
if(Status){
Return
}
sleep, 1000
try CurrentTabURL := driver.Url
; Msgbox % "CurrentTabURL: " CurrentTabURL
if(InStr(CurrentTabURL, "login")){
Message = Login Cookies Expired. Trying to Re-Login
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
sleep, 2000
Xpath = //div[contains(text(),'Login')]
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding
}
try CurrentTabURL := driver.Url
Message = Clicking into Speak your mind.. Box
; Msgbox % "CurrentTabURL: " CurrentTabURL
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
if(InStr(CurrentTabURL, "login")){
Message = Login Cookies Expired. Trying to Re-Login
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
loop, 3 {
sleep, 2000
if(A_index = 3){
Xpath = //div[contains(text(),'Login')]
SaveOrPostProgress(Message:="Failed to click into -speak your mind..- input box.",PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
SaveDriverURLOFErrorPage( )
driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding
Return
}
}
Message = Clicking into Speak your mind.. Box
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
; Click the Big Compose Box at the top of the page
Xpath = //div[@class='m-composer__triggerOverlay']
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=10,SleepLength:=1000)
; Status := Selenium_LoopToClickXpath(Xpath,5,1000)
if(Status){
SaveOrPostProgress(Message:="Login Expired. Please log back in",PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
loop, 3 {
; check that popup appears by checking for "Create Blog" button in popup
if(A_index = 3){
js = return document.querySelector("div[class='m-composer__base'] div[class='m-composerTitleBar__createBlogTrigger ng-star-inserted']").innerText
SaveOrPostProgress(Message:="Failed to click into -speak your mind..- input box.",PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
try status := driver.executeScript(js)
SaveDriverURLOFErrorPage()
if(InStr(Status, "Create Blog")){
Return
break
}
}
else, {
continue
}
; Msgbox % "status: " status
; Click the Big Compose Box at the top of the page
Xpath = //div[@class='m-composer__triggerOverlay']
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=10,SleepLength:=1000)
; Status := Selenium_LoopToClickXpath(Xpath,5,1000)
if(Status){
SaveOrPostProgress(Message:="Login Expired. Please log back in",PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
; check that popup appears by checking for "Create Blog" button in popup
js = return document.querySelector("div[class='m-composer__base'] div[class='m-composerTitleBar__createBlogTrigger ng-star-inserted']").innerText
try status := driver.executeScript(js)
if(InStr(Status, "Create Blog")){
break
}
else, {
continue
}
; Msgbox % "status: " status
}
; Attach Image
if(ImageAttachmentFilepath != ""){
; Click the upload image button
SaveOrPostProgress(Message:="Attaching Image",PostType:="Tooltip,ErrorLoggingTextFile")
Xpath = //input[@type='file']
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=ImageAttachmentFilepath)
if(Status){
Message = Failed to attach image (E#1203)
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
}
; Attach Image
SaveOrPostProgress(Message:="Waiting 2 seconds for Image to finish uploading",PostType:="Tooltip,ErrorLoggingTextFile")
if(ImageAttachmentFilepath != ""){
; Click the upload image button
SaveOrPostProgress(Message:="Attaching Image",PostType:="Tooltip,ErrorLoggingTextFile")
sleep, 2000
Xpath = //input[@type='file']
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=ImageAttachmentFilepath)
if(Status){
Message = Failed to attach image (E#1203)
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
SaveOrPostProgress(Message:="Waiting 2 seconds for Image to finish uploading ",PostType:="Tooltip,ErrorLoggingTextFile")
SaveOrPostProgress(Message:="Inputting Post Content`nMight take 5-15 seconds to get input",PostType:="Tooltip,ErrorLoggingTextFile")
sleep, 2000
; Click the plus button to make the title box show up
Xpath = //div[@class='m-composer__base m-composer__base--withPreview']//i[@class='material-icons ng-star-inserted'][normalize-space()='add_circle_outline']
try driver.FindElementByXPath(Xpath).click()
catch e { ; if failed to plus button, then input the post body and text into the same box
; msgbox, failed to click Plus
; goto, InputMindsPostCombined
}
; if plus button was clicked successfully, input title and body individually
; Input title
; Msgbox % "PostTitle: " PostTitle
Xpath = //textarea[@placeholder='Title']
; driver.FindElementByXPath(Xpath).SendKeys("heleeoeoe")
SaveOrPostProgress(Message:="Inputting Post Content`nMight take 5-15 seconds to get input",PostType:="Tooltip,ErrorLoggingTextFile")
; CLick into title box
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
; Click the plus button to make the title box show up
; Input text itno title box
Xpath = //div[@class='m-composer__base m-composer__base--withPreview']//i[@class='material-icons ng-star-inserted'][normalize-space()='add_circle_outline']
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=PostTitle)
try driver.FindElementByXPath(Xpath).click()
if(Status){ ; if failed to input title then skip to inputting both combined
catch e { ; if failed to plus button, then input the post body and text into the same box
; msgbox, failed to input title
; msgbox, failed to click Plus
Message = Failed to input Title
; goto, InputMindsPostCombined
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
}
; if plus button was clicked successfully, input title and body individually
; Input title
; Msgbox % "PostTitle: " PostTitle
Xpath = //textarea[@placeholder='Title']
; driver.FindElementByXPath(Xpath).SendKeys("heleeoeoe")
; CLick into title box
MindsTitleStatus := "Failed"
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
; Return
; Input text itno title box
; goto, InputMindsPostCombined
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=PostTitle)
}
if(Status){ ; if failed to input title then skip to inputting both combined
; msgbox, failed to input title
; msgbox, title input?
Message = Failed to input Title
; Input body
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
if(MindsTitleStatus)
MindsPost := PostTitleAndBody
MindsTitleStatus := "Failed"
else, MindsPost := PostBody
; Return
; goto, InputMindsPostCombined
; Msgbox % "PostBody: " PostBody
Xpath = //textarea[@id='minds-m-composer__textarea--1003']
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=MindsPost)
if(Status){
; msgbox, failed to input body
Message = Failed to post with Xpath, trying with ID
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Status := Selenium_LoopToSendValueToID("minds-m-composer__textarea--1003",5,1000,MindsPost)
if(Status){
Message = Failed to input Post Content into Page
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
}
}
}
else, { ; otherwise, input just text
SaveOrPostProgress(Message:="Inputting Text Post",PostType:="Tooltip,ErrorLoggingTextFile")
; DevModeMsgBox("Inputting Text Post")
Xpath = //textarea[@id='minds-m-composer__textarea--1003']
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=PostTitleAndBody)
; msgbox, title input?
; Input body
if(MindsTitleStatus)
MindsPost := PostTitleAndBody
else, MindsPost := PostBody
; Msgbox % "PostBody: " PostBody
if(Status){
Xpath = //textarea[@id='minds-m-composer__textarea--1003']
Message = Failed to post with Xpath, trying with ID
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=MindsPost)
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Status := Selenium_LoopToSendValueToID("minds-m-composer__textarea--1003",5,1000,PostTitleAndBody)
if(Status){
if(Status){
; msgbox, failed to input body
Message = Failed to input Post Content into Page
Message = Failed to post with Xpath, trying with ID
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Status := Selenium_LoopToSendValueToID("minds-m-composer__textarea--1003",5,1000,MindsPost)
Return
if(Status){
Message = Failed to input Post Content into Page
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
}
}
} else, { ; otherwise, input just text
}
SaveOrPostProgress(Message:="Inputting Text Post",PostType:="Tooltip,ErrorLoggingTextFile")
; DevModeMsgBox("Inputting Text Post")
Xpath = //textarea[@id='minds-m-composer__textarea--1003']
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=PostTitleAndBody)
DevModeMsgBox("done")
if(Status){
Message = Failed to post with Xpath, trying with ID
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Status := Selenium_LoopToSendValueToID("minds-m-composer__textarea--1003",5,1000,PostTitleAndBody)
if(Status){
Message = Failed to input Post Content into Page
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
}
if(InStr(PostBody,"http"))
if(InStr(PostBody,"http"))
{
{
Message = Sleeping 5 seconds for preview to load
Message = Sleeping 5 seconds for preview to load
SaveOrPostProgress(Message,PostType:="Tooltip,ErrorLoggingTextFile")
SaveOrPostProgress(Message,PostType:="Tooltip,ErrorLoggingTextFile")
sleep, 5000
sleep, 5000
}
}
}
}
; sleep, 2000
; sleep, 2000
SaveOrPostProgress(Message:="Submitting Post",PostType:="Tooltip,ErrorLoggingTextFile")
SaveOrPostProgress(Message:="Submitting Post",PostType:="Tooltip,ErrorLoggingTextFile")
loop, 3 {
loop, 3 {
if(A_index = 3){
if(A_index = 3){
SaveOrPostProgress(Message:="Failed to submit post",PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveOrPostProgress(Message:="Failed to submit post",PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
SaveDriverURLOFErrorPage()
Return
Return
}
}
; click submit button
; click submit button
js = document.querySelector("button[class='m-button m-button--blue m-button--small m-button--dropdown'] span[class='ng-star-inserted']").click();
js = document.querySelector("button[class='m-button m-button--blue m-button--small m-button--dropdown'] span[class='ng-star-inserted']").click();
try status := driver.executeScript(js)
try status := driver.executeScript(js)
catch e {
catch e {
Msgbox % "status: " status
Message = Clicking submit button with JS resulted in status: %status%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
}
}
SaveOrPostProgress(Message:="Waiting 5 seconds to confirm post got submitted",PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
SaveOrPostProgress(Message:="Waiting 5 seconds to confirm post got submitted",PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
sleep, 5000
sleep, 5000
; check that popup appears by checking for "Create Blog" button in popup
; check that popup appears by checking for "Create Blog" button in popup
js = return document.querySelector("div[class='m-composer__base'] div[class='m-composerTitleBar__createBlogTrigger ng-star-inserted']").innerText
js = return document.querySelector("div[class='m-composer__base'] div[class='m-composerTitleBar__createBlogTrigger ng-star-inserted']").innerText
try status := driver.executeScript(js)
try status := driver.executeScript(js)
if(InStr(Status, "Create Blog")){
if(InStr(Status, "Create Blog")){
continue
continue
}
}
else, {
else, {
break
break
}
}
}
}
/* if(!TestingMode){
/* if(!TestingMode){
@ -2361,71 +2368,80 @@ if(ImageAttachmentFilepath != ""){
Return
Return
; -------------------------------/Minds-------------------------------
; -------------------------------/Minds-------------------------------
; -------------------------------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
; -------------------------------Locals-------------------------------
Message = LocalsURL from Ini File: %LocalsURL%
PostToLocals:
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
CurrentSite := "Locals"
; DevModeMsgBox("clik ok to continue")
; @todo: Add auto-login to locals
SaveOrPostProgress(Message:="Navigating to Post Creation Page",PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
; LocalsURL := StrReplace(Localsurl, "/share/post", "")
IniRead, LocalsURL, %SettingsIniFilepath%, %ScriptSettingsSection%, LocalsURL, %A_Space%
; LocalsURL := Localsurl . "/login"
if(LocalsURL = ""){
; Message = Localsurl: %LocalsURL%
Message = Please add your Locals Profile URL to the settings.ini file under`n`n[General]`nLocalsURL=
; SaveOrPostProgress(Message:=Message,PostType:=",DiscordErrorLogging")
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return
}
Status := NavigateFromBaseURLTo(LocalsURL)
; Message = LocalsURL from Ini File: %LocalsURL%
if(Status = "Failed")
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Return
Status := CheckCurrentTabForCurrentSite()
; LocalsURL := StrReplace(Localsurl, "/share/post", "")
if(Status){
; LocalsURL := Localsurl . "/login"
Return
; Message = Localsurl: %LocalsURL%
}
; SaveOrPostProgress(Message:=Message,PostType:=",DiscordErrorLogging")
sleep, 1000
Message = Checking Login Status
Status := NavigateFromBaseURLTo(LocalsURL)
if(Status = "Failed")
Return
try CurrentTabURL := driver.Url
Status := CheckCurrentTabForCurrentSite()
if(InStr(CurrentTabURL, "/login") OR InStr(CurrentTabURL, "/register")){
if(Status){
Message = Login Expired. Please log back in
Return
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
}
SaveDriverURLOFErrorPage()
sleep, 1000
Return
}
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
}
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
; Xpath = //textarea[@id='body']
; Xpath = //textarea[@id='body']
; Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=2000)
; Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=2000)
; if(Status){
; if(Status){
; Message = Trying to Log Back In
; Message = Trying to Log Back In
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
; LocalsLoginURL := LocalsURL . "/login"
; LocalsLoginURL := LocalsURL . "/login"
; try driver.Get(LocalsLoginURL) ;Open selected URL
; try driver.Get(LocalsLoginURL) ;Open selected URL
; try driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding
; try driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding
; sleep, 3000
; sleep, 3000
; js = document.getElementsByName('submit')[0].click();
; js = document.getElementsByName('submit')[0].click();
; try driver.executeScript(js)
; try driver.executeScript(js)
; ; DevModeMsgBox(js)
; ; DevModeMsgBox(js)
; ; clipboard := js
; ; clipboard := js
; try driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding
; try driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding
; sleep, 5000
; sleep, 5000
; ; try driver.Get(LocalsURL) ;Open selected URL
; ; try driver.Get(LocalsURL) ;Open selected URL
; ; try driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding
; ; try driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding
; Xpath = //textarea[@id='body']
; Xpath = //textarea[@id='body']
; Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=2000)
; Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=2000)
; {
; {
; Message = Post Failed: Check Login Status
; Message = Post Failed: Check Login Status
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
; Return
; Return
; }
; }
/* Message = Post Failed: Check Login Status
/* Message = Post Failed: Check Login Status
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")