@ -30,16 +30,17 @@ global UpdateVersionNumber
;---Notes/Extra Info/#Includes------------------------------------------------------
#Include %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\Freedomain-Posters-Shared-Functions.ahk
; #Include %A_ScriptDir%\Lib\SharedFunctions.ahk
#Include %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\Json.ahk
; #Include %A_ScriptDir%\Lib\ChromeAutomationFunctions.ahk
#include %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\StdOutToVar.ahk
#Include %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\General-Shared-Functions.ahk
#Include %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\Selenium-Shared-Functions.ahk
#Include %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\Gitea-Shared-Functions.ahk
#Include %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\APIs-Shared-Functions.ahk
#Include %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\JSON.ahk
#Include %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\RunCMD.ahk
ScriptName = Freedomain Social Media Poster
ScriptVersion = 2.74
ScriptVersion = 2.75
FullScriptName := ScriptName . " " . ScriptVersion
;---ToDo---
@ -182,7 +183,7 @@ UpdateURL = https://freedomainplaylists.com/wp-content/FreedomainScripts/Freedom
*/
global GitReleasesAPIURL
GitReleasesAPIURL = https://git.zinchuk.xyz /api/v1/repos/yuriy/Freedomain-Social-Media-Poster/releases
GitReleasesAPIURL =https://git.freedomainplaylists.com /api/v1/repos/yuriy/Freedomain-Social-Media-Poster/releases
; Save filepath of the current script to %SettingsIniFilepath% so it can be read and used by the script updater
; Append informatio to ini files for Freedomain Program Updater
@ -631,7 +632,7 @@ run, "%A_ScriptFullPath%" "LastPost"
Return
OpenGiteaPage:
run, https://git.zinchuk.xyz /yuriy/Freedomain_Social_Media_Poster
run, https://git.freedomainplaylists.com /yuriy/Freedomain_Social_Media_Poster
Return
CompileScript:
@ -1310,8 +1311,6 @@ AddToTotalPostsPostedCount()
PauseBetweenPosts()
; TakeScreenshotOfPage()
; ; sleep, %TimeBetweenPosts%
DevModeMsgBox("done!")
Return
@ -1339,8 +1338,6 @@ if(Status){
}
; Check login status by checking the header of the page for "Feed" text
loop, 5 {
SaveOrPostProgress(Message:="Checking Login Status",PostType:="Tooltip,ErrorLoggingTextFile")
@ -1549,14 +1546,17 @@ if(InStr(CurrentTabURL, "/login")){
*/
; Msgbox % "Status: " Status
IniWrite, Successful, %StatusFileFilePath%, Status, Parler
AddToTotalPostsPostedCount()
Message = Submitted Successfully
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
PauseBetweenPosts()
; TakeScreenshotOfPage()
DevModeMsgBox("done!")
Return
@ -1693,6 +1693,11 @@ if(InStr(CurrentTabURL, "/login")){
IniWrite, Successful, %StatusFileFilePath%, Status, Discord
AddToTotalPostsPostedCount()
Message = Submitted Successfully
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Return
; -------------------------------/Discord-------------------------------
@ -1776,7 +1781,6 @@ if(InStr(CurrentTabURL, "/login")){
if(Status){
Message = Login Expired. Please log back in
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
; TakeScreenshotOfPage()
SaveDriverURLOFErrorPage()
Return
}
@ -1805,8 +1809,6 @@ if(InStr(CurrentTabURL, "/login")){
if(Status){
Message = Failed to Input Post using Direct Xpath. Trying with Relative
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
; TakeScreenshotOfPage()
; msgbox, 1
Xpath = /html/body/div/div[3]/div[2]/div[2]/div/div[1]/form/div[2]/div[1]/trix-editor
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000,StringTextContent:=PostTitleAndBody)
@ -1821,7 +1823,6 @@ if(InStr(CurrentTabURL, "/login")){
catch e {
Message = Failed to Input Post Contents (E#8281)
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
; TakeScreenshotOfPage()
SaveDriverURLOFErrorPage()
Return
}
@ -1879,8 +1880,9 @@ if(InStr(CurrentTabURL, "/login")){
PauseBetweenPosts()
; TakeScreenshotOfPage()
DevModeMsgBox("done!")
Message = Submitted Successfully
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Return
; -------------------------------/SubScribeStar-------------------------------
@ -1984,6 +1986,10 @@ if(InStr(CurrentTabURL, "/login")){
IniWrite, Successful, %StatusFileFilePath%, Status, Telegram
AddToTotalPostsPostedCount()
Message = Submitted Successfully
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Return
; -------------------------------/Telegram-------------------------------
@ -2207,12 +2213,15 @@ if(InStr(CurrentTabURL, "/login")){
IniWrite, Successful, %StatusFileFilePath%, Status, LinkedIn
AddToTotalPostsPostedCount()
DevModeMsgBox("done!")
; DevModeMsgBox("done!")
PauseBetweenPosts()
; TakeScreenshotOfPage()
DevModeMsgBox("done!")
Message = Submitted Successfully
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Return
; -------------------------------/LinkedIn-------------------------------
@ -2450,9 +2459,12 @@ if(InStr(CurrentTabURL, "/login")){
PauseBetweenPosts()
; TakeScreenshotOfPage()
DevModeMsgBox("done!")
Message = Submitted Successfully
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Return
; -------------------------------/Minds-------------------------------
@ -2536,7 +2548,7 @@ if(InStr(CurrentTabURL, "/login")){
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
if(Status){
SaveOrPostProgress(Message:="Post Failed: Check Login Status",PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
; TakeScreenshotOfPage()
Return
}
@ -2650,9 +2662,12 @@ if(InStr(CurrentTabURL, "/login")){
SaveOrPostProgress(Message:=Message,PostType:="Tooltip")
PauseBetweenPosts()
; TakeScreenshotOfPage()
DevModeMsgBox("done!")
Message = Submitted Successfully
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Return
; -------------------------------/Locals-------------------------------
@ -2763,9 +2778,11 @@ if(InStr(CurrentTabURL, "/login")){
SaveOrPostProgress(Message:=Message,PostType:="Tooltip")
PauseBetweenPosts()
; TakeScreenshotOfPage()
DevModeMsgBox("done!")
Message = Submitted Successfully
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Return
; -------------------------------/Gab-------------------------------
@ -3022,9 +3039,12 @@ if(InStr(CurrentTabURL, "/login")){
SaveOrPostProgress(Message:=Message,PostType:="Tooltip")
PauseBetweenPosts()
; TakeScreenshotOfPage()
DevModeMsgBox("done!")
Message = Submitted Successfully
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Return
; -------------------------------/Bastyon-------------------------------
@ -3214,9 +3234,12 @@ if(InStr(CurrentTabURL, "/login")){
PauseBetweenPosts()
; TakeScreenshotOfPage()
DevModeMsgBox("done!")
Message = Submitted Successfully
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Return
;-----------------------/Steemit-------------------------
@ -3343,7 +3366,6 @@ if(InStr(CurrentTabURL, "/login")){
PauseBetweenPosts()
; TakeScreenshotOfPage()
DevModeMsgBox("done!")
@ -3475,10 +3497,13 @@ AddToTotalPostsPostedCount()
PauseBetweenPosts()
; TakeScreenshotOfPage()
DevModeMsgBox("done!")
Message = Submitted Successfully
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Return
; -------------------------------/MeWe-------------------------------
@ -3568,7 +3593,6 @@ status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength
if(Status){
Message = Failed to Input Post
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
; TakeScreenshotOfPage()
SaveDriverURLOFErrorPage()
Return
}
@ -3627,9 +3651,11 @@ AddToTotalPostsPostedCount()
PauseBetweenPosts()
; TakeScreenshotOfPage()
DevModeMsgBox("done!")
Message = Submitted Successfully
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Return
; -------------------------------/Twetch-------------------------------
@ -3653,7 +3679,38 @@ if(Status){
Return
}
SaveOrPostProgress(Message:="Inputting Text",PostType:="Tooltip,ErrorLoggingTextFile")
Message = Checking Login Status
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
js = return document.querySelector(".sc-iTONeN.jMeRLz.items").textContent;
try, status := driver.executeScript(js)
if(InStr(Status, "Sign in")){
if(AutoLogin){
; click Sign In button at top of page
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
; click login button underneath username/password fields
Xpath = //input[@name='login']
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
}
else, {
Message = Login Expired. Please log back in
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
}
SaveOrPostProgress(Message:="Inputting Post",PostType:="Tooltip,ErrorLoggingTextFile")
sleep, 1000
@ -3662,27 +3719,13 @@ Xpath = //input[@placeholder='Share whatever flotes your boat..']
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=2000)
if(Status){
; if error, then try clicking on "Login" button at the top right
Message = Unable to Click "Write New Post" Button. Trying to Re-Login
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Xpath = //div[@class='nav-action-button blue-link half-padding-left half-padding-right white-space-no-wrap'] ; Log in button
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
if(Status){ ; if failed to click login button
SaveOrPostProgress(Message:="Post Failed: Check Login Status",PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
TabUrl := GetCurrentTabURlBase()
Message = Unable to Click into New Post Box. Please check login status. Current URL: %TabUrl%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
else, { ; if login button was clicked successfully. try logging in
sleep, 2000
Xpath = //button[@class='submit-button ng-star-inserted']
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
if(Status){ ; if failed to click login button, give error and quit
SaveOrPostProgress(Message:="Login Expired. Please log back in",PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return
}
Xpath = //div[@class='new-text-area'] ; start new post button
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000)
}
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
}
sleep, 1000
@ -3762,10 +3805,13 @@ AddToTotalPostsPostedCount()
PauseBetweenPosts()
; TakeScreenshotOfPage()
DevModeMsgBox("done!")
Message = Submitted Successfully
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Return
; -------------------------------/Flote-------------------------------
@ -3954,12 +4000,15 @@ AddToTotalPostsPostedCount()
PauseBetweenPosts()
; TakeScreenshotOfPage()
; dismiss the pop up that appears for some reason
; try driver.switchToalert().accept()
DevModeMsgBox("done!")
Message = Submitted Successfully
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Return
; -------------------------------/ThinkSpot-------------------------------