14 Commits

10 changed files with 14540 additions and 336 deletions

2
.gitmodules vendored
View File

@@ -1,3 +1,3 @@
[submodule "Lib/Freedomain-Posters-Shared-Functions"] [submodule "Lib/Freedomain-Posters-Shared-Functions"]
path = Lib/Freedomain-Posters-Shared-Functions path = Lib/Freedomain-Posters-Shared-Functions
url = https://git.freedomainplaylists.com/yuriy/Freedomain-Posters-Shared-Functions.git url = https://freedomain.dev/yuriy/posters-shared-functions.git

View File

@@ -42,7 +42,7 @@ global UpdateVersionNumber
ScriptName = Freedomain Social Media Poster ScriptName = Freedomain Social Media Poster
ScriptVersion = 2.83 ScriptVersion = 2.88
FullScriptName := ScriptName . " " . ScriptVersion FullScriptName := ScriptName . " " . ScriptVersion
;---ToDo--- ;---ToDo---
@@ -98,7 +98,7 @@ global Locals
global LinkedIn global LinkedIn
global MeWe global MeWe
global Twetch global Twetch
global ThinkSpot ; global ThinkSpot
; global Flote ; global Flote
global PocketNet global PocketNet
; global parler ; global parler
@@ -175,7 +175,7 @@ IniRead, TotalRunTime, %SettingsIniFilepath%, %ScriptSettingsSection%, TotalRunT
;------------------------------------------------ ;------------------------------------------------
global GitReleasesAPIURL global GitReleasesAPIURL
GitReleasesAPIURL =https://git.freedomainplaylists.com/api/v1/repos/yuriy/Freedomain-Social-Media-Poster/releases GitReleasesAPIURL = https://freedomain.dev/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 ; 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 ; Append informatio to ini files for Freedomain Program Updater
@@ -216,7 +216,8 @@ if(InStr(ErrorLoggingDirectory,ScriptName) and InStr(ErrorLoggingDirectory,".exe
} }
if(StrLen(ErrorLoggingDirectory) > 5 and !InStr(ErrorLoggingDirectory, ".exe")){ ; if argument was passed in, read contents from that directory ; if argument was passed in, read contents from that directory and grab video info for social media post
if(StrLen(ErrorLoggingDirectory) > 5 and !InStr(ErrorLoggingDirectory, ".exe")){
; SaveOrPostProgress(Message:="Starting Up: Reading Information from Files",PostType:="Tooltip") ; SaveOrPostProgress(Message:="Starting Up: Reading Information from Files",PostType:="Tooltip")
SkipUpdateCheckThisRun := 1 SkipUpdateCheckThisRun := 1
@@ -251,19 +252,25 @@ if(StrLen(ErrorLoggingDirectory) > 5 and !InStr(ErrorLoggingDirectory, ".exe")){
; Read video links from video links file ; Read video links from video links file
IniRead, BitChuteURL, %ErrorLoggingDirectory%,URLs, BitChuteURL, %A_Space% IniRead, BitChuteURL, %ErrorLoggingDirectory%,URLs, BitChuteURL, %A_Space%
IniRead, RumbleURL, %ErrorLoggingDirectory%,URLs, RumbleURL, %A_Space% IniRead, RumbleURL, %ErrorLoggingDirectory%,URLs, RumbleURL, %A_Space%
IniRead, StreamanityURL, %ErrorLoggingDirectory%,URLs, StreamanityURL, %A_Space% IniRead, BrighteonURL, %ErrorLoggingDirectory%,URLs, BrighteonURL, %A_Space%
; IniRead, BitChuteURL, %ErrorLoggingDirectory%,URLs, BitChuteURL, %A_Space% IniRead, BitChuteURL, %ErrorLoggingDirectory%,URLs, BitChuteURL, %A_Space%
IniRead, PodcastNumber, %ErrorLoggingDirectory%,Misc, PodcastNumber, %A_Space%
if(BitChuteURL = ""){ if(BitChuteURL = ""){
if(RumbleURL != "") if(RumbleURL != "")
VideoURL := RumbleURL VideoURL := RumbleURL
else, else,
VideoURL := StreamanityURL VideoURL := BrighteonURL
} }
else, else,
VideoURL := BitChuteURL VideoURL := BitChuteURL
if(PodcastNumber != ""){
PodcastURL := "https://fdrpodcasts.com/" . PodcastNumber . "`n"
}
; Append bitchute url to bottom of description ; Append bitchute url to bottom of description
PostBody := PostBody . "`n`n" . VideoURL PostBody := PostBody . "`n`n" . PodcastURL . VideoURL
; Msgbox % "PostTitle: " PostTitle ; Msgbox % "PostTitle: " PostTitle
; Msgbox % "PostBody: " PostBody ; Msgbox % "PostBody: " PostBody
@@ -293,13 +300,13 @@ if(StrLen(ErrorLoggingDirectory) > 5 and !InStr(ErrorLoggingDirectory, ".exe")){
(Telegram != "")?(TelegramCheckStatus := 0) : (TelegramCheckStatus := 1) (Telegram != "")?(TelegramCheckStatus := 0) : (TelegramCheckStatus := 1)
(Minds != "")?(MindsCheckStatus := 0) : (MindsCheckStatus := 1) (Minds != "")?(MindsCheckStatus := 0) : (MindsCheckStatus := 1)
(Gab != "")?(GabCheckStatus := 0) : (GabCheckStatus := 1) (Gab != "")?(GabCheckStatus := 0) : (GabCheckStatus := 1)
(MeWe != "")?(MeWeCheckStatus := 0) : (MeWeCheckStatus := 1) ; UNCHECKED ALWAYS as of 2022/04/08 (MeWe != "")?(MeWeCheckStatus := 0) : (MeWeCheckStatus := 0) ; UNCHECKED ALWAYS as of 2022/04/08
(Gettr != "")?(GettrCheckStatus := 0) : (GettrCheckStatus := 1) (Gettr != "")?(GettrCheckStatus := 0) : (GettrCheckStatus := 0)
(Steemit != "")?(SteemitCheckStatus := 0) : (SteemitCheckStatus := 1) (Steemit != "")?(SteemitCheckStatus := 0) : (SteemitCheckStatus := 1)
(Locals != "")?(LocalsCheckStatus := 0) : (LocalsCheckStatus := 1) (Locals != "")?(LocalsCheckStatus := 0) : (LocalsCheckStatus := 1)
(LinkedIN != "")?(LinkedINCheckStatus := 0) : (LinkedINCheckStatus := 1) (LinkedIN != "")?(LinkedINCheckStatus := 0) : (LinkedINCheckStatus := 1)
(Twetch != "")?(TwetchCheckStatus := 0) : (TwetchCheckStatus := 1) (Twetch != "")?(TwetchCheckStatus := 0) : (TwetchCheckStatus := 0)
(ThinkSpot != "")?(ThinkSpotCheckStatus := 0) : (ThinkSpotCheckStatus := 1) ; (ThinkSpot != "")?(ThinkSpotCheckStatus := 0) : (ThinkSpotCheckStatus := 0)
; (Flote != "")?(FloteCheckStatus := 0) : (FloteCheckStatus := 0) ; (Flote != "")?(FloteCheckStatus := 0) : (FloteCheckStatus := 0)
; (Pintrest != "")?(PintrestCheckStatus := 0) : (PintrestCheckStatus := 1) ; (Pintrest != "")?(PintrestCheckStatus := 0) : (PintrestCheckStatus := 1)
; (Parler != "")?(ParlerCheckStatus := 0) : (ParlerCheckStatus := 0) ; (Parler != "")?(ParlerCheckStatus := 0) : (ParlerCheckStatus := 0)
@@ -320,7 +327,7 @@ if(TestingMode){ ; Easy testing for Yuriy
LinkedINCheckStatus := 0 LinkedINCheckStatus := 0
MeWeCheckStatus := 0 MeWeCheckStatus := 0
TwetchCheckStatus := 0 TwetchCheckStatus := 0
ThinkSpotCheckStatus := 0 ; ThinkSpotCheckStatus := 0
PocketNetCheckStatus := 0 PocketNetCheckStatus := 0
} }
@@ -479,9 +486,9 @@ Gui, Add, Checkbox, y+7 vTwetch Checked%TwetchCheckStatus% gUpdateVars, Twetch
; Second Row ; Second Row
; Gui, Add, Checkbox, vLinkedIn Checked%LinkedINCheckStatus% gUpdateVars, LinkedIn ; Gui, Add, Checkbox, vLinkedIn Checked%LinkedINCheckStatus% gUpdateVars, LinkedIn
Gui, Add, Checkbox, x+75 yp-180 vLinkedIn Checked%LinkedINCheckStatus% gUpdateVars, LinkedIn Gui, Add, Checkbox, x+75 yp-190 vLinkedIn Checked%LinkedINCheckStatus% gUpdateVars, LinkedIn
; Gui, Add, Checkbox, y+7 vLinkedIn Checked%LinkedINCheckStatus% gUpdateVars, LinkedIn ; Gui, Add, Checkbox, y+7 vLinkedIn Checked%LinkedINCheckStatus% gUpdateVars, LinkedIn
Gui, Add, Checkbox, y+7 vThinkspot Checked%ThinkSpotCheckStatus% gUpdateVars, Thinkspot ; Gui, Add, Checkbox, y+7 vThinkspot Checked%ThinkSpotCheckStatus% gUpdateVars, Thinkspot
; Gui, Add, Checkbox, y+7 vFlote Checked%FloteCheckStatus% gUpdateVars, Flote ; Gui, Add, Checkbox, y+7 vFlote Checked%FloteCheckStatus% gUpdateVars, Flote
; Gui, Add, Checkbox, y+7 vParler Checked%ParlerCheckStatus% gUpdateVars, Parler ; Gui, Add, Checkbox, y+7 vParler Checked%ParlerCheckStatus% gUpdateVars, Parler
Gui, Add, Checkbox, y+7 vSteemit Checked%SteemitCheckStatus% gUpdateVars, Steemit Gui, Add, Checkbox, y+7 vSteemit Checked%SteemitCheckStatus% gUpdateVars, Steemit
@@ -512,13 +519,22 @@ ControlFocus, Edit1, %FullScriptName%
; check for updates if the setting is enabled ; check for updates if the setting is enabled
if(AutoUpdateCheck AND !SkipUpdateCheckThisRun){ if(AutoUpdateCheck AND !UpdateAvailable){
CheckForUpdates(GitReleasesAPIURL) Message = Checking for Updates
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
; DevModeMsgBox("checking for updates")
; msgbox, checkin for update
; DevModeMsgBox(GitReleasesAPIURL)
; UpdateAvailable :=
if(CheckForUpdates(GitReleasesAPIURL))
GuiControl,,UpdateAvailable, Uploader Update Available! GuiControl,,UpdateAvailable, Uploader Update Available!
; if(CheckForChromeUpdates(ChromeFilepath)) if(CheckForChromeUpdates(ChromeFilepath)){
; GuiControl,,ChromeUpdateAvailable, Chrome Update Available! GuiControl,,ChromeUpdateAvailable, Chrome Update Available!
ChromeUpdateAvailable := 1
}
} }
@@ -615,7 +631,9 @@ if(!status){
} }
DownloadLatestChromium() Status := DownloadLatestChromium()
if(Status)
GuiControl,,ChromeUpdateAvailable, Chrome Up-to-Dat
Return Return
@@ -649,7 +667,7 @@ run, "%A_ScriptFullPath%" "LastPost"
Return Return
OpenGiteaPage: OpenGiteaPage:
run, https://git.freedomainplaylists.com/yuriy/Freedomain_Social_Media_Poster run, https://freedomain.dev/yuriy/social-media-poster
Return Return
CompileScript: CompileScript:
@@ -808,7 +826,7 @@ IniWrite, %ShowTooltipProgress%, %SettingsIniFilepath%, SocialMediaPoster, ShowT
(Locals = 1)?(PostedWebsites .= "Locals|") : () (Locals = 1)?(PostedWebsites .= "Locals|") : ()
(LinkedIn = 1)?(PostedWebsites .= "LinkedIn|") : () (LinkedIn = 1)?(PostedWebsites .= "LinkedIn|") : ()
(Twetch = 1)?(PostedWebsites .= "Twetch|") : () (Twetch = 1)?(PostedWebsites .= "Twetch|") : ()
(ThinkSpot = 1)?(PostedWebsites .= "ThinkSpot|") : () ; (ThinkSpot = 0)?(PostedWebsites .= "ThinkSpot|") : ()
; (Flote = 1)?(PostedWebsites .= "Flote|") : () ; (Flote = 1)?(PostedWebsites .= "Flote|") : ()
(PocketNet = 1)?(PostedWebsites .= "PocketNet|") : () (PocketNet = 1)?(PostedWebsites .= "PocketNet|") : ()
(Gettr = 1)?(PostedWebsites .= "Gettr|") : () (Gettr = 1)?(PostedWebsites .= "Gettr|") : ()
@@ -883,8 +901,8 @@ Gosub, PostToMeWe
if(Twetch) if(Twetch)
Gosub, PostToTwetch Gosub, PostToTwetch
if(Thinkspot) ; if(Thinkspot)
Gosub, PostToThinkSpot ; Gosub, PostToThinkSpot
if(Locals) if(Locals)
Gosub, PostToLocals Gosub, PostToLocals
@@ -976,20 +994,14 @@ Gui, Add, Button,x%MarginSpace% w%WebsiteButtonWidths% h%ButtonHeights% Center,
Gui, Add, Edit, x+5 w%WebsiteStatusEditWidths% h%ButtonHeights%, %MeWe% Gui, Add, Edit, x+5 w%WebsiteStatusEditWidths% h%ButtonHeights%, %MeWe%
Gui, Font, s9
Gui, Add, Button, x%MarginSpace% y+20 w165 h50 gCancelPost, Close
Gui, Add, Button, x+%Marginspace% w215 h50 gSendErrorLoggingThroughTelegram, Telegram Detailed Errorlog
Gui, Add, Button, x+%Marginspace% h50 w165 gTryFailedAgain, Try Failed Again
Gui, Font, s%GUINormalFontSize% Gui, Font, s%GUINormalFontSize%
gui, font, s8 ; gui, font, s8
Gui, Add, Button,x%StatusTextSecondRowXPos% y40 w%WebsiteButtonWidths%Center h%ButtonHeights%, ThinkSpot ; Gui, Add, Button,x%StatusTextSecondRowXPos% y40 w%WebsiteButtonWidths%Center h%ButtonHeights%, ThinkSpot
Gui, Font, s%GUINormalFontSize% ; Gui, Font, s%GUINormalFontSize%
Gui, Add, Edit, x+5 w%WebsiteStatusEditWidths% h%ButtonHeights%, %ThinkSpot% ; Gui, Add, Edit, x+5 w%WebsiteStatusEditWidths% h%ButtonHeights%, %ThinkSpot%
Gui, Font, s%GUINormalFontSize% ; Gui, Font, s%GUINormalFontSize%
; Gui, Add, Button,x%StatusTextSecondRowXPos% y+%MarginSpace% w%WebsiteButtonWidths% h%ButtonHeights% Center, Flote ; Gui, Add, Button,x%StatusTextSecondRowXPos% y+%MarginSpace% w%WebsiteButtonWidths% h%ButtonHeights% Center, Flote
; Gui, Add, Edit, x+5 w%WebsiteStatusEditWidths% h%ButtonHeights%, %Flote% ; Gui, Add, Edit, x+5 w%WebsiteStatusEditWidths% h%ButtonHeights%, %Flote%
@@ -997,21 +1009,31 @@ Gui, Font, s%GUINormalFontSize%
; Gui, Add, Button,x%StatusTextSecondRowXPos% y+%MarginSpace% w%WebsiteButtonWidths% h%ButtonHeights% gActivateParlerTab Center, Parler ; Gui, Add, Button,x%StatusTextSecondRowXPos% y+%MarginSpace% w%WebsiteButtonWidths% h%ButtonHeights% gActivateParlerTab Center, Parler
; Gui, Add, Edit, x+5 w%WebsiteStatusEditWidths% h%ButtonHeights%, %Parler% ; Gui, Add, Edit, x+5 w%WebsiteStatusEditWidths% h%ButtonHeights%, %Parler%
Gui, Add, Button,x%StatusTextSecondRowXPos% y+%MarginSpace% w%WebsiteButtonWidths% h%ButtonHeights% Center, Steemit Gui, Add, Button,x%MarginSpace% w%WebsiteButtonWidths% h%ButtonHeights% Center, Steemit
Gui, Add, Edit, x+5 w%WebsiteStatusEditWidths% h%ButtonHeights%, %Steemit% Gui, Add, Edit, x+5 w%WebsiteStatusEditWidths% h%ButtonHeights%, %Steemit%
; Gui, Add, Button,x%StatusTextSecondRowXPos% y+%MarginSpace% w%WebsiteButtonWidths% h%ButtonHeights% Center, Pintrest ; Gui, Add, Button,x%StatusTextSecondRowXPos% y+%MarginSpace% w%WebsiteButtonWidths% h%ButtonHeights% Center, Pintrest
; Gui, Add, Edit, x+5 w%WebsiteStatusEditWidths% h%ButtonHeights%, %Pintrest% ; Gui, Add, Edit, x+5 w%WebsiteStatusEditWidths% h%ButtonHeights%, %Pintrest%
Gui, Add, Button,x%StatusTextSecondRowXPos% y+%MarginSpace% w%WebsiteButtonWidths% h%ButtonHeights% Center, Bastyon Gui, Add, Button,x%MarginSpace% w%WebsiteButtonWidths% h%ButtonHeights% Center, Bastyon
Gui, Add, Edit, x+5 w%WebsiteStatusEditWidths% h%ButtonHeights%, %PocketNet% Gui, Add, Edit, x+5 w%WebsiteStatusEditWidths% h%ButtonHeights%, %PocketNet%
; Gui, Add, Button,x%StatusTextSecondRowXPos% y+%MarginSpace% w%WebsiteButtonWidths% h%ButtonHeights% Center, Tumblr ; Gui, Add, Button,x%StatusTextSecondRowXPos% y+%MarginSpace% w%WebsiteButtonWidths% h%ButtonHeights% Center, Tumblr
; Gui, Add, Edit, x+5 w%WebsiteStatusEditWidths% h%ButtonHeights%, %Tumblr% ; Gui, Add, Edit, x+5 w%WebsiteStatusEditWidths% h%ButtonHeights%, %Tumblr%
; Gui, Font, s9
/*
Gui, Add, Button, x%MarginSpace% y+20 w165 h50 gCancelPost, Close
Gui, Add, Button, x+%Marginspace% w215 h50 gSendErrorLoggingThroughTelegram, Telegram Detailed Errorlog
*/
Gui, Font, s8 Gui, Font, s8
Gui, Add, Button, x%StatusTextSecondRowXPos% y+40 w270 h40 Center gCopyPostToClipboard, Copy Post To Clipboard `nFor Easy Pasting to Other Sites Gui, Add, Button, x%StatusTextSecondRowXPos% y40 w270 h40 Center gCopyPostToClipboard, Copy Post To Clipboard `nFor Easy Pasting to Other Sites
Gui, Add, Button, x%StatusTextSecondRowXPos% y+%MarginSpace% w270 h40 Center gCopyImageFilepathToClipboard, Copy Image Filepath To Clipboard Gui, Add, Button, x%StatusTextSecondRowXPos% y+%marginspace% w270 h40 Center gCopyImageFilepathToClipboard, Copy Image Filepath To Clipboard
Gui, Add, Button, x%StatusTextSecondRowXPos% y+%marginspace% h50 w270 h80 gTryFailedAgain, Try Failed Again
/*Gui, Add, Button,x%MarginSpace% w%WebsiteButtonWidths% h%ButtonHeights% Center, PocketNet /*Gui, Add, Button,x%MarginSpace% w%WebsiteButtonWidths% h%ButtonHeights% Center, PocketNet
@@ -1169,7 +1191,7 @@ Return
; Thinkspot ; Thinkspot
;------------------------------------------------ ;------------------------------------------------
#include %A_ScriptDir%\Modules\Post-To-Thinkspot.ahk ; #include %A_ScriptDir%\Modules\Post-To-Thinkspot.ahk
; Misc Functions ; Misc Functions
;------------------------------------------------ ;------------------------------------------------

File diff suppressed because one or more lines are too long

View File

@@ -8,30 +8,13 @@ SaveOrPostProgress(Message:="Navigating to Post Creation Page",PostType:="Toolti
IniRead, LocalsURL, %SettingsIniFilepath%, %ScriptSettingsSection%, LocalsURL, %A_Space% IniRead, LocalsURL, %SettingsIniFilepath%, %ScriptSettingsSection%, LocalsURL, %A_Space%
if(LocalsURL = ""){ if(LocalsURL = "" OR !InStr(LocalsURL, "/share/post")){
Message = Please add your Locals Profile URL to the settings.ini file under`n`n[General]`nLocalsURL= 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") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return Return
} }
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"
; Message = Localsurl: %LocalsURL%
; SaveOrPostProgress(Message:=Message,PostType:=",DiscordErrorLogging")
Status := NavigateFromBaseURLTo(LocalsURL) Status := NavigateFromBaseURLTo(LocalsURL)
if(Status = "Failed") if(Status = "Failed")
Return Return
@@ -58,12 +41,22 @@ if(InStr(CurrentTabURL, "/login") OR InStr(CurrentTabURL, "/register")){
Message = Inputting Post Content Message = Inputting Post Content
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
Xpath = //input[@id='title']
try driver.FindElementByXPath(Xpath).click()
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=PostTitle)
if(Status){
Message = Failed to input Title
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
Xpath = //*[@id="body"] Xpath = //*[@id="body"]
try driver.FindElementByXPath(Xpath).click() try driver.FindElementByXPath(Xpath).click()
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=PostTitleAndBody) Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=PostBody)
if(Status){ if(Status){
Message = Failed to input Title Message = Failed to input Body
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
SaveDriverURLOFErrorPage() SaveDriverURLOFErrorPage()
Return Return
@@ -96,39 +89,22 @@ if(ImageAttachmentFilepath != ""){
Message = Submitting Post Message = Submitting Post
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
; 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
/* ; Click the final "post" button if(InStr(CurrentTabURL, "share/post")) { ; post failed to submit if it's still on the create new post page
SaveOrPostProgress(Message:="Submitting Post",PostType:="Tooltip,ErrorLoggingTextFile") Message = Error: Post Was Input but Failed to Submit.
Status := Selenium_LoopToClickName(ElementName:="submitPost",NumOfLoops:=5,SleepLength:=1000) SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
if(Status){ SaveDriverURLOFErrorPage()
Message = Failed to Submit Post Return
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
} }

View File

@@ -194,30 +194,32 @@ loop, 3 {
} }
; msgbox, ork?
; click submit button Loop, 5 {
js = document.querySelector("button[class='m-button m-button--blue m-button--small m-button--dropdown'] span[class='ng-star-inserted']").click(); if(A_index = 5){
try status := driver.executeScript(js) Message = Failed to submit after 5 attempts.
catch e {
Message = Clicking submit button with JS resulted in status: %status%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Message = Trying to click the Post button using Xpath
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Xpath = (//span[@class='ng-star-inserted'][normalize-space()='Post'])[2]
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
if(Status){
Message = Failed to Submit Post after 2 different attempts
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage() SaveDriverURLOFErrorPage()
Return Return
} }
} 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)
sleep, 500
; check if Post button still exists
js = return document.querySelector("m-composer__base[ismodal='true'] m-button[data-ref='post-button'] div").innerText
try, Status := driver.executeScript(js) ;Executes a Javascript on the webpage, mostly used for buttons.
if(!Status){
; msgbox, successfully submitted after %A_index% attempts
break
}
sleep, 1000
}
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")

View File

@@ -61,7 +61,29 @@ if(InStr(LoginStatus, "Log In")){ ; need to log in
Message = Inputting Post Message = Inputting Post
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
; Click on "Start your post by clicking here" ; click the "Create Post" button
js = document.querySelector("div[class='new_post'] div[class='flat_button for-new_post']").click(); ; Send content through javascript (Great for getting around emoji chrome limitaitons)
try, driver.executeScript(js)
sleep, 1000
; post button at bottom right corner
Selector = ".flat_button.for-post_form"
; check if post button exists
js = return document.querySelector(%Selector%).innerText
try, Status := driver.executeScript(js)
if(!Status){
Message = Post Failed. Failed to click on "Create Post" button
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
/*; Click on "Start your post by clicking here"
Xpath = //div[contains(text(),'Create Post')] Xpath = //div[contains(text(),'Create Post')]
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000) Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000)
if(Status){ if(Status){
@@ -84,6 +106,7 @@ if(Status){
} }
} }
} }
*/
; sleep, 5000 ; sleep, 5000
; msgbox ; msgbox
@@ -102,34 +125,51 @@ if(Status){
; Input Text into pop-up edit box ; Input Text into pop-up edit box
SaveOrPostProgress(Message:="Inputting Post Content",PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:="Inputting Post Content",PostType:="Tooltip,ErrorLoggingTextFile")
; click on heading format button
Xpath = //button[@title='Heading']//i
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
sleep, 500
Xpath = //trix-editor[@role='textbox'] Xpath = //trix-editor[@role='textbox']
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000,StringTextContent:=PostTitleAndBody) Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=PostTitle)
if(Status){ if(Status){
Message = Failed to Input Post using Direct Xpath. Trying with Relative Message = Failed to input Post Title
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Xpath = /html/body/div/div[3]/div[2]/div[2]/div/div[1]/form/div[2]/div[1]/trix-editor Return
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000,StringTextContent:=PostTitleAndBody)
if(Status){
Message = Failed to Input Post using Relative Xpath. Trying with Javascript
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
SubscribeStarJSDescription := FormatTextToJSText(PostTitleAndBody)
js = document.querySelector("trix-editor[role='textbox']").value = "%SubscribeStarJSDescription%";
try driver.executeScript(js) ;Executes a Javascript on the webpage, mostly used for buttons.
catch e {
Message = Failed to Input Post Contents (E#8281)
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
; msgbox, 3
}
} }
; driver.FindElementByXPath(Xpath).SendKeys(PostTitle)
sleep, 500
driver.FindElementByXPath(Xpath).SendKeys("`n`n")
sleep, 500
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=PostBody)
if(Status){
Message = Failed to input Post Body
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
; check if value was input
js = return document.querySelector("trix-editor[role='textbox']").innerText
try, Status := driver.executeScript(js)
if(!Status){
Message = Failed to input Post Content (E#8282)
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return
}
else, { ; if input successfully, post to error log
String := SubStr(Status, 1, 30)
Message = Post Content that got input: %String% ...
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
}
; Attach an image if a filepath was provided ; Attach an image if a filepath was provided
if(ImageAttachmentFilepath != ""){ if(ImageAttachmentFilepath != ""){
SaveOrPostProgress(Message:="Attaching Image",PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:="Attaching Image",PostType:="Tooltip,ErrorLoggingTextFile")
@@ -163,7 +203,55 @@ if(ImageAttachmentFilepath != ""){
; Click the post Button ; Click the post Button
SaveOrPostProgress(Message:="Submitting Post",PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:="Submitting Post",PostType:="Tooltip,ErrorLoggingTextFile")
Xpath = //button[contains(text(),'Post')]
; post button at bottom right corner
Selector = ".flat_button.for-post_form"
; check if post button exists
js = return document.querySelector(%Selector%).innerText
try, Status := driver.executeScript(js)
if(!Status){
Message = Post Failed. Unable to find Post button using usual method.
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
else, {
Message = Post Button Exists and has the text: %Status%
SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile,DiscordErrorLogging")
}
; click submit button
js = document.querySelector(%Selector%).click()
try, Status := driver.executeScript(js)
; Msgbox % "Status: " Status
sleep, 2000
; check if post button still exists
js = return document.querySelector(%Selector%).innerText
try, Status := driver.executeScript(js)
if(Status){
Message = Post Failed. Failed to click Post button using usual method.
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
; double double check that post got posted by checking if able to grab text that was just input
js = return document.querySelector("trix-editor[role='textbox']").innerText
try, Status := driver.executeScript(js)
if(Status){
Message = Post Failed. Input box still exists on page but no errors were thrown when clicking post button
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
/* Xpath = //button[contains(text(),'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
@@ -172,6 +260,7 @@ if(ImageAttachmentFilepath != ""){
Return Return
} }
*/
IniWrite, Successful, %StatusFileFilePath%, Status, SubScribeStar IniWrite, Successful, %StatusFileFilePath%, Status, SubScribeStar
AddToTotalPostsPostedCount() AddToTotalPostsPostedCount()

View File

@@ -1,196 +0,0 @@
; -------------------------------ThinkSpot-------------------------------
PostToThinkSpot:
CurrentSite := "Thinkspot"
if(PostTags = ""){
Message = Skipped: No Post Tags
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
IniWrite, Skipped: No Post Tags, %StatusFileFilePath%, Status, Thinkspot
Return
}
SaveOrPostProgress(Message:="Navigating to Post Creation Page",PostType:="Tooltip,ErrorLoggingTextFile")
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
URLAttempt := NavigateFromBaseURLTo("https://www.thinkspot.com/create/post")
if(URLAttempt = "Failed")
Return
Status := CheckCurrentTabForCurrentSite()
if(Status){
Return
}
Message = Checking Login Status
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
sleep, 1000
try CurrentTabURL := driver.Url
if(InStr(CurrentTabURL, "/sign_in")){
Message = Login Cookies Expired. Trying to Re-Login
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
; SaveDriverURLOFErrorPage()
; Return
Xpath = //input[@name='commit']
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=1,SleepLength:=1000)
if(!Status){
Message = Logged in Successfully
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Status := NavigateFromBaseURLTo("https://www.thinkspot.com/create/post")
(Status)?(Return):()
sleep, 2000
}
}
Status := CheckCurrentTabForCurrentSite()
if(Status){
Return
}
/*
Xpath = //a[@href='/create/post']
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000)
if(Status){
Message = Failed to Click "Create Post" button
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return
}
*/
; CLick into the title box of the new post window
Xpath = //div[@id='editorjs']//div[@class='ql-editor ql-blank']
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000)
if(Status){
Message = Failed to Click Into Titlebox: Check Login Status
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return
}
sleep, 500
; Input the Post Title
SaveOrPostProgress(Message:="Inputting Post Title",PostType:="Tooltip,ErrorLoggingTextFile")
Xpath = //input[@id='title']
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000,SendKeysContent:=PostTitle)
if(Status){
Message = Failed to Input Post Title: Check Login Status
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return
}
; Input post body
if(ImageAttachmentFilepath != "")
PostBody := PostBody . "`n"
SaveOrPostProgress(Message:="Inputting Post Content",PostType:="Tooltip,ErrorLoggingTextFile")
Xpath = //div[@id='editorjs']//p
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000,SendKeysContent:=PostBody)
if(Status){
Message = Failed to Input Post Body: Check Login Status
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return
}
; Input Post Tags
Xpath = //span[@role='textbox']
TagsArray := StrSplit(PostTags, ",")
TagsArrayLength := TagsArray.Length() ; Save total number of items in the array
loop, %TagsArrayLength%{
Tag := TagsArray[A_Index]
Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000,SendKeysContent:=Tag)
try driver.FindElementByXPath(Xpath).SendKeys(driver.Keys.ENTER)
}
if(ImageAttachmentFilepath != ""){
; Click "Image" button
SaveOrPostProgress(Message:="Attaching Image",PostType:="Tooltip,ErrorLoggingTextFile")
; Insert image by sending it directly.
; elements aren't loaded until the attach image button is pressed though, so defeats the purpose
/*Xpath = //input[@class='ql-image']
try driver.FindElementByXPath(Xpath).SendKeys(ImageAttachmentFilepath)
*/
Xpath = //button[@class='ql-image']
Status := Selenium_LoopToClickXpathAndWaitForOpenWindow(Xpath:=Xpath,NumOfLoops:=10,SleepLength:=1000)
if(Status){
Message = Failed to click "Attach Image" button
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Xpath = //input[@class='ql-image']
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=ImageAttachmentFilepath)
if(Status){
Message = Failed to Attach Image (E#7611)
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return
}
}
else, {
InputStatus := InputFilePathIntoOpenWindow(ImageAttachmentFilepath)
if(InputStatus = "Failed")
{
sleep, 2000
Xpath = //i[@class='material-icons-outlined'][normalize-space()='image'] ; give it a second try :fingerscrossed:
Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000)
InputStatus := InputFilePathIntoOpenWindow(ImageAttachmentFilepath)
if(InputStatus)
{ ; Try sending directly to element
Xpath = //input[@class='ql-image']
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=ImageAttachmentFilepath)
if(Status){
Message = Failed to Attach Image (E#7612)
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return
}
}
}
}
SaveOrPostProgress(Message:="Waiting 10 seconds for Image to finish uploading",PostType:="Tooltip,ErrorLoggingTextFile")
sleep, 10000
}
; Click the Post button
SaveOrPostProgress(Message:="Submitting Post",PostType:="Tooltip,ErrorLoggingTextFile")
Xpath = //button[normalize-space()='Post']
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000)
if(Status){
Message = Failed to Submit Post
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return
}
IniWrite, Successful, %StatusFileFilePath%, Status, Thinkspot
AddToTotalPostsPostedCount()
PauseBetweenPosts()
; dismiss the pop up that appears for some reason
; try driver.switchToalert().accept()
DevModeMsgBox("done!")
Message = Post Publish Successful
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Return
; -------------------------------/ThinkSpot-------------------------------

View File

@@ -115,7 +115,7 @@ sleep, 2000
SaveOrPostProgress(Message:="Submitting Post",PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:="Submitting Post",PostType:="Tooltip,ErrorLoggingTextFile")
Xpath = //button[normalize-space()='Post $0.02'] Xpath = //button[@id='composer-post-btn']
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=4,SleepLength:=1000) Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=4,SleepLength:=1000)
if(Status){ if(Status){
Message = Failed to click on Submit Post Button Message = Failed to click on Submit Post Button

View File

@@ -32,7 +32,7 @@ Automated posting to the following social media platforms, utilizing either the
- Open Chrome and type in `about::version` into the URL bar. The very first line will tell you what Chrome version you have - Open Chrome and type in `about::version` into the URL bar. The very first line will tell you what Chrome version you have
- After downloading, extract “chromedriver_win32.zip” and move the extracted chromedriver.exe to: `C:\Program Files\SeleniumBasic\chromedriver.exe` - After downloading, extract “chromedriver_win32.zip” and move the extracted chromedriver.exe to: `C:\Program Files\SeleniumBasic\chromedriver.exe`
- NOTE: The chromedriver will need to be re-downloaded whenever Chrome updates to keep up with API changes - NOTE: The chromedriver will need to be re-downloaded whenever Chrome updates to keep up with API changes
4. [Download the latest .exe of the Poster](https://git.zinchuk.xyz/yuriy/Freedomain-Social-Media-Poster/releases) 4. [Download the latest .exe of the Poster](/yuriy/social-media-poster/releases)
- When run, the poster will automatically create the folders and files it requires in the directory it's run from. - When run, the poster will automatically create the folders and files it requires in the directory it's run from.
# Settings.ini # Settings.ini
@@ -59,4 +59,4 @@ Ive done my best to catch any possible errors that might pop up and write fun
# Compiling To .exe From Source # Compiling To .exe From Source
1. [Install Autohotkey v1](https://www.autohotkey.com/download/) 1. [Install Autohotkey v1](https://www.autohotkey.com/download/)
2. `git clone` the project and then either run the `Compile Uploader to EXE.ahk` autohotkey script to compile automatically, or start up the AHK compiler that comes installed with Autohotkey and select the `Freedomain Social Media Poster.ahk` and `\Assets\FreedomainSMP.ico` icon. 2. `git clone` the project and then either run the `Compile Uploader to EXE.ahk` autohotkey script to compile automatically, or start up the AHK compiler that comes installed with Autohotkey and select the `Freedomain Social Media Poster.ahk` and `\Assets\FreedomainSMP.ico` icon.