3 Commits
2.91 ... 2.92

13 changed files with 320 additions and 366 deletions

View File

@@ -11,6 +11,7 @@ if(InStr(A_ScriptName, ".ahk")){
} }
ErrorLoggingDirectory = %1% ErrorLoggingDirectory = %1%
PassedInArgument = %1%
; Add menus to the toolbar icon ; Add menus to the toolbar icon
Menu, tray, NoStandard ; remove standard tray Menu, tray, NoStandard ; remove standard tray
@@ -124,6 +125,7 @@ ScriptSettingsSection := "SocialMediaPoster"
FileInstall, Version.ini, %A_ScriptDir%\Lib\Version.ini, 1 FileInstall, Version.ini, %A_ScriptDir%\Lib\Version.ini, 1
IniRead, ScriptVersion, %A_ScriptDir%\Lib\Version.ini,Social-Media-Poster, Version, 0.0 IniRead, ScriptVersion, %A_ScriptDir%\Lib\Version.ini,Social-Media-Poster, Version, 0.0
ScriptName = Freedomain Social Media Poster ScriptName = Freedomain Social Media Poster
ScriptAbbreviatedName := "FSMP"
FullScriptName := ScriptName . " " . ScriptVersion FullScriptName := ScriptName . " " . ScriptVersion
@@ -137,6 +139,8 @@ IniRead, TelegramBotChatID, %SettingsIniFilepath%, SocialMediaPoster, TelegramBo
IniRead, DiscordErrorLoggingWebhookBotURL, %SettingsIniFilepath%, SocialMediaPoster, DiscordErrorLoggingWebhookBotURL, %A_Space% IniRead, DiscordErrorLoggingWebhookBotURL, %SettingsIniFilepath%, SocialMediaPoster, DiscordErrorLoggingWebhookBotURL, %A_Space%
IniRead, DiscordParlerWebhookURL, %SettingsIniFilepath%, SocialMediaPoster, DiscordParlerWebhookURL, %A_Space% IniRead, DiscordParlerWebhookURL, %SettingsIniFilepath%, SocialMediaPoster, DiscordParlerWebhookURL, %A_Space%
IniRead, ChromeFilepath, %SettingsIniFilepath%, SocialMediaPoster, ChromeFilepath, %A_Space% IniRead, ChromeFilepath, %SettingsIniFilepath%, SocialMediaPoster, ChromeFilepath, %A_Space%
IniRead, ConfirmBeforeSubmit, %SettingsIniFilepath%, %ScriptSettingsSection%, ConfirmBeforeSubmit, 1
; IniRead, SaveGUIPosition, %SettingsIniFilepath%, %ScriptSettingsSection%, SaveGUIPosition, 1
@@ -278,10 +282,6 @@ if(StrLen(ErrorLoggingDirectory) > 5 and !InStr(ErrorLoggingDirectory, ".exe")){
; Append bitchute url to bottom of description ; Append bitchute url to bottom of description
PostBody := PostBody . "`n`n" . PodcastURL . VideoURL PostBody := PostBody . "`n`n" . PodcastURL . VideoURL
; Msgbox % "PostTitle: " PostTitle
; Msgbox % "PostBody: " PostBody
Discord := 0 Discord := 0
Telegram := 0 Telegram := 0
} }
@@ -312,12 +312,7 @@ if(StrLen(ErrorLoggingDirectory) > 5 and !InStr(ErrorLoggingDirectory, ".exe")){
(Locals != "")?(LocalsCheckStatus := 0) : (LocalsCheckStatus := 1) (Locals != "")?(LocalsCheckStatus := 0) : (LocalsCheckStatus := 1)
(LinkedIN != "")?(LinkedINCheckStatus := 0) : (LinkedINCheckStatus := 1) (LinkedIN != "")?(LinkedINCheckStatus := 0) : (LinkedINCheckStatus := 1)
(Twetch != "")?(TwetchCheckStatus := 0) : (TwetchCheckStatus := 0) (Twetch != "")?(TwetchCheckStatus := 0) : (TwetchCheckStatus := 0)
; (ThinkSpot != "")?(ThinkSpotCheckStatus := 0) : (ThinkSpotCheckStatus := 0)
; (Flote != "")?(FloteCheckStatus := 0) : (FloteCheckStatus := 0)
; (Pintrest != "")?(PintrestCheckStatus := 0) : (PintrestCheckStatus := 1)
; (Parler != "")?(ParlerCheckStatus := 0) : (ParlerCheckStatus := 0)
(PocketNet != "")?(PocketNetCheckStatus := 0) : (PocketNetCheckStatus := 1) (PocketNet != "")?(PocketNetCheckStatus := 0) : (PocketNetCheckStatus := 1)
; (Tumblr != "")?(TumblrCheckStatus := 0) : (TumblrCheckStatus := 1)
@@ -333,13 +328,15 @@ if(TestingMode){ ; Easy testing for Yuriy
LinkedINCheckStatus := 0 LinkedINCheckStatus := 0
MeWeCheckStatus := 0 MeWeCheckStatus := 0
TwetchCheckStatus := 0 TwetchCheckStatus := 0
; ThinkSpotCheckStatus := 0
PocketNetCheckStatus := 0 PocketNetCheckStatus := 0
} }
;---GUI Variables--- ;---GUI Variables---
;------------------------------------------------ ;------------------------------------------------
IniRead, XPosition, %SettingsIniFilepath%, %ScriptSettingsSection%, XPosition, 0
IniRead, YPosition, %SettingsIniFilepath%, %ScriptSettingsSection%, YPosition, 0
TooltipXPosition := Round((A_ScreenWidth / 2) - (A_ScreenWidth / 10)) ; Center Tooltip on the screen and a bit to the left TooltipXPosition := Round((A_ScreenWidth / 2) - (A_ScreenWidth / 10)) ; Center Tooltip on the screen and a bit to the left
GuiWidth := 1366 GuiWidth := 1366
@@ -369,6 +366,11 @@ Gui, Margin, %MarginSpace%, %MarginSpace%
GUINormalFontSize := 15 GUINormalFontSize := 15
; Create GUI Elements
; ------------------------------------------------
Gui, Font, s10 Gui, Font, s10
; Gui, Font, s8 ; Gui, Font, s8
if(TestingMode){ if(TestingMode){
@@ -381,21 +383,25 @@ if(DevMode){
Gui, Font, s%GUINormalFontSize% Gui, Font, s%GUINormalFontSize%
Gui, Font, Bold Gui, Font, Bold
Gui, Add, Text, x%Marginspace% y+5 w%EditBoxWidth%, Post Title Gui, Add, Text, x%Marginspace% y+5, Post Title
Gui, Font, s8 Gui, Font, s8
Gui, Add, Checkbox, xp+120 yp+10 vBoldTitleWAPI Checked%BoldTitleCheckStatus% gUpdateVars,Bold Title on Discord/Telegram Gui, Font, Normal
Gui, Add, Checkbox, xp+220 yp+0 vNewLineBetweenTitle Checked%SpaceBetweenTitleBodyCheckStatus% gUpdateVars,Blank Line Between Title+Body Gui, Font, s8
Gui, Add, Button, x+%MarginSpace% gPasteClipboardToEditBox vPasteClipboardToSMPTitle, Paste Clipboard
Gui, Add, Checkbox, xp+120 vBoldTitleWAPI Checked%BoldTitleCheckStatus% gUpdateVars,Bold Title on Discord/Telegram
Gui, Add, Checkbox, xp+220 vNewLineBetweenTitle Checked%SpaceBetweenTitleBodyCheckStatus% gUpdateVars,Blank Line Between Title+Body
Gui, Font, Normal Gui, Font, Normal
Gui, Font, s%GUINormalFontSize% Gui, Font, s%GUINormalFontSize%
Gui, Add, Edit, x%MarginSpace% y+3 w%EditBoxWidth% vPostTitle gUpdateCharCount h75, %PostTitle% Gui, Add, Edit, x%MarginSpace% y+%marginspace% w%EditBoxWidth% vPostTitle gUpdateCharCount h50, %PostTitle%
Gui, Font, Bold Gui, Font, Bold
Gui, Add, Text,w%EditBoxWidth%, Post Body Gui, Add, Text,, Post Body
Gui, Font, Normal Gui, Font, Normal
Gui, Font, s8
Gui, Add, Button, x+%MarginSpace% gPasteClipboardToEditBox vPasteClipboardToSMPBody, Paste Clipboard
Gui, Font, s%GUINormalFontSize% Gui, Font, s%GUINormalFontSize%
Gui, Add, Edit, x%MarginSpace% y+2 w%EditBoxWidth% h150 vPostBody gUpdateCharCount, %PostBody% Gui, Add, Edit, x%MarginSpace% y+2 w%EditBoxWidth% h200 vPostBody gUpdateCharCount, %PostBody%
; Gui, font, color, cblack ; Gui, font, color, cblack
@@ -465,19 +471,16 @@ Gui, Add, GroupBox,r4 x%PlatformsGroupBoxXLocation% y20 w300, Settings
Gui, Font, s11 Gui, Font, s11
Gui, Font, Normal Gui, Font, Normal
Gui, Add, Checkbox, xp+10 yp+25 vAutoUpdateCheck Checked%AutoUpdateCheckCheckStatus% gUpdateVars, Auto Update Check Gui, Add, Checkbox, xp+10 yp+25 vAutoUpdateCheck Checked%AutoUpdateCheckCheckStatus% gUpdateVars, Auto Update Check
Gui, Add, Checkbox, vReuseTabs Checked%ReuseTabsCheckStatus% gUpdateVars, Try to Re-Use Tabs ; Gui, Add, Checkbox, vReuseTabs Checked%ReuseTabsCheckStatus% gUpdateVars, Try to Re-Use Tabs
; Gui, Add, Checkbox, vNewChromeWindow Checked%AutoUpdateCheckCheckStatus% gUpdateVars, Create New Chrome Window (WIP)
Gui, Add, Checkbox,vShowTooltipProgress Checked%ShowTooltipProgressCheckStatus% gUpdateVars, Show Tooltip of Progress Gui, Add, Checkbox,vShowTooltipProgress Checked%ShowTooltipProgressCheckStatus% gUpdateVars, Show Tooltip of Progress
; Gui, Add, Checkbox, vAutoUpdateCheck Checked%AutoUpdateCheckCheckStatus% gUpdateVars, Auto Update Check
Gui, Add, Checkbox, vSaveTagsBetweenPosts Checked%SaveTagsBetweenPostsCheckStatus% gUpdateVars, Save Tags Between Posts Gui, Add, Checkbox, vSaveTagsBetweenPosts Checked%SaveTagsBetweenPostsCheckStatus% gUpdateVars, Save Tags Between Posts
Gui, Add, Checkbox, vPauseBetweenPosts Checked%PauseBetweenPostsCheckCheckStatus% gUpdateVars, Pause Briefly Between Posts Gui, Add, Checkbox, vConfirmBeforeSubmit checked%ConfirmBeforeSubmit%, Confirm Before Submit
; Gui, Add, Checkbox, vSaveGUIPosition checked%SaveGUIPosition%, Save GUI Position
; Gui, Add, Checkbox, vPauseBetweenPosts Checked%PauseBetweenPostsCheckCheckStatus% gUpdateVars, Pause Briefly Between Posts
; Gui, Add, Checkbox, vAutoRestartChromeDebug Checked%PauseBetweenPostsCheckCheckStatus% gUpdateVars, Auto Restart Chrome in Debug Mode ; Gui, Add, Checkbox, vAutoRestartChromeDebug Checked%PauseBetweenPostsCheckCheckStatus% gUpdateVars, Auto Restart Chrome in Debug Mode
Gui, Font, s%GUINormalFontSize% Gui, Font, s%GUINormalFontSize%
Gui, Font, Bold Gui, Font, Bold
Gui, Add, GroupBox,r6.4 x%PlatformsGroupBoxXLocation% y210 w300, Platforms Gui, Add, GroupBox,r6.4 x%PlatformsGroupBoxXLocation% y210 w300, Platforms
Gui, Font, Normal Gui, Font, Normal
@@ -489,26 +492,16 @@ Gui, Add, Checkbox, y+7 vGab Checked%GabCheckStatus% gUpdateVars, Gab
Gui, Add, Checkbox, y+7 vLocals Checked%LocalsCheckStatus% gUpdateVars, Locals Gui, Add, Checkbox, y+7 vLocals Checked%LocalsCheckStatus% gUpdateVars, Locals
Gui, Add, Checkbox, y+7 vTwetch Checked%TwetchCheckStatus% gUpdateVars, Twetch 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, x+75 yp-190 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 vThinkspot Checked%ThinkSpotCheckStatus% gUpdateVars, Thinkspot
; 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 vSteemit Checked%SteemitCheckStatus% gUpdateVars, Steemit Gui, Add, Checkbox, y+7 vSteemit Checked%SteemitCheckStatus% gUpdateVars, Steemit
; Gui, Add, Checkbox, y+7 vPintrest Checked%PintrestCheckStatus% gUpdateVars, Pintrest
Gui, Add, Checkbox, y+7 vPocketNet Checked%PocketNetCheckStatus% , Bastyon Gui, Add, Checkbox, y+7 vPocketNet Checked%PocketNetCheckStatus% , Bastyon
; Gui, Add, Checkbox, y+7 vTumblr Checked%TumblrCheckStatus% , Tumblr
Gui, Add, Checkbox, y+7 vGettr Checked%GettrCheckStatus% gUpdateVars, Gettr Gui, Add, Checkbox, y+7 vGettr Checked%GettrCheckStatus% gUpdateVars, Gettr
Gui, Add, Checkbox, y+7 vMeWe Checked%MeWeCheckStatus% gUpdateVars, MeWe Gui, Add, Checkbox, y+7 vMeWe Checked%MeWeCheckStatus% gUpdateVars, MeWe
Gui, Font, Bold Gui, Font, Bold
gui, Font, s15 gui, Font, s15
; : Gui, Add, Text, , My Text.
; Gui, Font, Color, Red
Gui, Add, Button, x%PlatformsGroupBoxXLocation% y485 w300 h113 gPostPost, Publish Gui, Add, Button, x%PlatformsGroupBoxXLocation% y485 w300 h113 gPostPost, Publish
; Gui, Add, Button, x%PlatformsGroupBoxXLocation% y+20 w300 h30 gSchedulePost, Schedule Post ; Gui, Add, Button, x%PlatformsGroupBoxXLocation% y+20 w300 h30 gSchedulePost, Schedule Post
@@ -520,32 +513,19 @@ gui, font, normal
Gui, Add, StatusBar,, Total Posts Posted: %TotalPostsPosted% | Total Run Time: %TotalRunTime% Seconds | Gui, Add, StatusBar,, Total Posts Posted: %TotalPostsPosted% | Total Run Time: %TotalRunTime% Seconds |
; easier to just let the gui size be as needed instead of trying to recalculate the size each time an element is added ; easier to just let the gui size be as needed instead of trying to recalculate the size each time an element is added
Gui, Show,,%FullScriptName% ; , w%GuiWidth%, %ScriptName% ; if(SaveGUIPosition)
Gui, Show, x%XPosition% y%YPosition% ,%FullScriptName% ; , w%GuiWidth%, %ScriptName%
; else,
; Gui, Show,,%FullScriptName% ; , w%GuiWidth%, %ScriptName%
; Activate the Post Title input box so user can start instantly typing in their new message
ControlFocus, Edit1, %FullScriptName% ControlFocus, Edit1, %FullScriptName%
; check for updates if the setting is enabled ; check for updates if the setting is enabled
if(AutoUpdateCheck AND !UpdateAvailable){ if(AutoUpdateCheck AND !UpdateAvailable){
Message = Checking for Updates SetTimer, CheckForUpdates, -1000
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!
if(CheckForChromeUpdates(ChromeFilepath)){
GuiControl,,ChromeUpdateAvailable, Chrome Update Available!
ChromeUpdateAvailable := 1
}
} }
;---Check for Update---
;------------------------------------------------
Return Return
@@ -554,6 +534,9 @@ Return
;---Misc GoSubs--- ;---Misc GoSubs---
;------------------------------------------------ ;------------------------------------------------
SaveAsTemplate: SaveAsTemplate:
TemplateDirectory = %A_ScriptDir%\Lib\Templates TemplateDirectory = %A_ScriptDir%\Lib\Templates
if(!FileExist(TemplateDirectory)){ if(!FileExist(TemplateDirectory)){
@@ -703,19 +686,12 @@ UpdateCharCount:
Gui, Submit, NoHide Gui, Submit, NoHide
Count := StrLen(PostBody) Count := StrLen(PostBody)
/*if(Count > 256){
GuiControl,, Twetch, 0
}
*/
GuiControl,, CharCount, %Count% GuiControl,, CharCount, %Count%
Return Return
TryFailedAgain: TryFailedAgain:
; msgbox %ErrorLoggingDirectory%
run, %A_ScriptFullPath% "LastPost" run, %A_ScriptFullPath% "LastPost"
ExitApp ExitApp
; Return ; Return
@@ -727,7 +703,6 @@ Gui, Submit
Gui, Destroy Gui, Destroy
Gui, Font, Normal Gui, Font, Normal
Gui, Font, s20 Gui, Font, s20
Gui, Add, Text, Center w350 x%marginspace%,Time to Post At Gui, Add, Text, Center w350 x%marginspace%,Time to Post At
@@ -742,9 +717,10 @@ Return
PostPost: PostPost:
Gui, Submit Gui, Submit, NoHide
; Msgbox % "PostTags: " PostTags ; Get GUI window position for saving to settings file
WinGetPos, XPosition, YPosition, , , A
if(InStr(PostTags, "http")){ if(InStr(PostTags, "http")){
Message = Post Tags contain "http". Please edit and remove the url and try again. Message = Post Tags contain "http". Please edit and remove the url and try again.
@@ -756,7 +732,6 @@ if(InStr(PostTags, "http")){
Gui, Destroy Gui, Destroy
; 20211023061711
ScheduledTime := SubStr(ScheduledTime, 1, 12) ; pull out time date up to the minute and exclude seconds ScheduledTime := SubStr(ScheduledTime, 1, 12) ; pull out time date up to the minute and exclude seconds
; Msgbox % "ScheduledTime: " ScheduledTime ; Msgbox % "ScheduledTime: " ScheduledTime
; clipboard := ScheduledTime ; clipboard := ScheduledTime
@@ -769,7 +744,6 @@ ScheduledTime := SubStr(ScheduledTime, 1, 12) ; pull out time date up to the min
; if the argument is an error logging post, we want to continue where it left off and log to the same place ; if the argument is an error logging post, we want to continue where it left off and log to the same place
; Msgbox % "ErrorLoggingDirectory: " ErrorLoggingDirectory
if(InStr(ErrorLoggingDirectory, "\Templates\") OR ErrorLoggingDirectory = "" OR InStr(ErrorLoggingDirectory, "VideoLinks.ini")){ if(InStr(ErrorLoggingDirectory, "\Templates\") OR ErrorLoggingDirectory = "" OR InStr(ErrorLoggingDirectory, "VideoLinks.ini")){
; msgbox, creating new error logging files ; msgbox, creating new error logging files
CreateErrorLoggingFiles() CreateErrorLoggingFiles()
@@ -777,6 +751,11 @@ if(InStr(ErrorLoggingDirectory, "\Templates\") OR ErrorLoggingDirectory = "" OR
} ; } ;
; Save Script Settings to File
; ------------------------------------------------
IniWrite, %XPosition%, %SettingsIniFilepath%, %ScriptSettingsSection%, XPosition
IniWrite, %YPosition%, %SettingsIniFilepath%, %ScriptSettingsSection%, YPosition
IniWrite, %BoldTitleWAPI%, %SettingsIniFilepath%, SocialMediaPoster, BoldTitleWAPI IniWrite, %BoldTitleWAPI%, %SettingsIniFilepath%, SocialMediaPoster, BoldTitleWAPI
IniWrite, %NewLineBetweenTitle%, %SettingsIniFilepath%, SocialMediaPoster, NewLineBetweenTitle IniWrite, %NewLineBetweenTitle%, %SettingsIniFilepath%, SocialMediaPoster, NewLineBetweenTitle
@@ -787,6 +766,14 @@ IniWrite, %SaveTagsBetweenPosts%, %SettingsIniFilepath%, SocialMediaPoster, Save
IniWrite, %PauseBetweenPosts%, %SettingsIniFilepath%, SocialMediaPoster, PauseBetweenPosts IniWrite, %PauseBetweenPosts%, %SettingsIniFilepath%, SocialMediaPoster, PauseBetweenPosts
IniWrite, %ErrorLoggingDirectory%, %SettingsIniFilepath%, %ScriptSettingsSection%, LastPost IniWrite, %ErrorLoggingDirectory%, %SettingsIniFilepath%, %ScriptSettingsSection%, LastPost
IniWrite, %ConfirmBeforeSubmit%, %SettingsIniFilepath%, %ScriptSettingsSection%, ConfirmBeforeSubmit
; IniWrite, %SaveGUIPosition%, %SettingsIniFilepath%, %ScriptSettingsSection%, SaveGUIPosition
; Used by Post Scheduler, filepath changes between script updates
IniWrite, %A_ScriptFullPath%, %SettingsIniFilepath%, Filepaths, SocialMediaPosterFilepath
; Combines two variables together so they can be used as needed later ; Combines two variables together so they can be used as needed later
@@ -1059,7 +1046,10 @@ Gui, Font, s%GUINormalFontSize%
gui, font, s6 gui, font, s6
Gui, Add, StatusBar,, Total Posts Posted: %TotalPostsPosted% | Run Time: %ScriptRunTime% Seconds Gui, Add, StatusBar,, Total Posts Posted: %TotalPostsPosted% | Run Time: %ScriptRunTime% Seconds
Gui, Show,, %FullScriptName% - Post Results ; if(SaveGUIPosition)
Gui, Show, x%XPosition% y%YPosition%, %FullScriptName% - Post Results
; else,
; Gui, Show,, %FullScriptName% - Post Results
SaveCurrentChromeVersionToIniFile() SaveCurrentChromeVersionToIniFile()
@@ -1202,3 +1192,6 @@ Return
; Misc Functions ; Misc Functions
;------------------------------------------------ ;------------------------------------------------
#include %A_ScriptDir%\Modules\Miscellaneous-Functions.ahk #include %A_ScriptDir%\Modules\Miscellaneous-Functions.ahk
; used by update checker and paste from clipboard
#include %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\Shared-GoTos.ahk

View File

@@ -30,34 +30,6 @@ ReadWebsiteStatuses(){
; IniRead, Tumblr, %StatusFileFilePath%, Status, Tumblr, %A_Space% ; IniRead, Tumblr, %StatusFileFilePath%, Status, Tumblr, %A_Space%
} }
; -------------------------------CreateErrorLoggingFiles-------------------------------
CreateErrorLoggingFiles(Path := ""){
FormatTime, TodayDate, YYYYMMDDHH24MISS, yyyyMMdd_hhmmss
ErrorLoggingDirectory := Path
if(Path = ""){
ErrorLoggingDirectory := A_ScriptDir . "\Lib\ErrorLogging"
; If directory for error logging doesn't exist, create it
if(!FileExist(ErrorLoggingDirectory))
FileCreateDir, %ErrorLoggingDirectory%
ErrorLoggingDirectory := ErrorLoggingDirectory . "\" . TodayDate . "_FSMP"
}
; Msgbox % "ErrorLoggingDirectory: " ErrorLoggingDirectory
FileCreateDir, %ErrorLoggingDirectory%
; Create variables with filepaths that content will be saved to.
ErrorLoggingFilePath := ErrorLoggingDirectory . "\" . "ErrorLogging.txt"
StatusFileFilePath := ErrorLoggingDirectory . "\" . "PostStatus.ini"
PostTitleFilePath := ErrorLoggingDirectory . "\" . "PostTitle.txt"
PostBodyFilePath := ErrorLoggingDirectory . "\" . "PostBody.txt"
; Msgbox % "ErrorLoggingDirectory: " ErrorLoggingDirectory
Return
}
; -------------------------------/CreateErrorLoggingFiles-------------------------------
AddToTotalPostsPostedCount(){ AddToTotalPostsPostedCount(){
IniRead, TotalPostsPosted, %SettingsIniFilepath%, SocialMediaPoster, TotalPostsPosted, 0 IniRead, TotalPostsPosted, %SettingsIniFilepath%, SocialMediaPoster, TotalPostsPosted, 0
TotalPostsPosted += 1 TotalPostsPosted += 1

View File

@@ -100,77 +100,70 @@ if(Status = ""){
sleep, 2000 sleep, 2000
/*
*/
if(ImageAttachmentFilepath != ""){
; Message = Attaching Image
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip")
if(ImageAttachmentFilepath != ""){ ; Click the "Image" button
; Message = Attaching Image SaveOrPostProgress(Message:="Attaching Image",PostType:="Tooltip,ErrorLoggingTextFile")
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip")
; Click the "Image" button Xpath = //input[@type='file']
SaveOrPostProgress(Message:="Attaching Image",PostType:="Tooltip,ErrorLoggingTextFile") Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=3,SleepLength:=5000,StringTextContent:=ImageAttachmentFilepath)
/* Xpath = //div[@title='Add Images to Post'] if(Status){
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000) Message = Failed to Attach Image
if(Status){ SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Message = Failed to Click "Attach Image" Button SaveDriverURLOFErrorPage()
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") Return
SaveDriverURLOFErrorPage()
Return
}
*/
; sleep, 5000
Xpath = //input[@type='file']
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=3,SleepLength:=5000,StringTextContent:=ImageAttachmentFilepath)
if(Status){
Message = Failed to Attach Image
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
SaveOrPostProgress(Message:="Waiting 10 Seconds For Image to Upload",PostType:="Tooltip,ErrorLoggingTextFile")
sleep, 10000
}
; Input Tags
Xpath = //div[@class='search fastSearchShow']//input[@id='text']
TagsArray := StrSplit(PostTags, ",")
TagsArrayLength := TagsArray.Length() ; Save total number of items in the array
loop, %TagsArrayLength% {
Tag := TagsArray[A_Index]
Tag := StrReplace(Tag, " ", "")
DevModeMsgBox(Tag)
; Tag = %Tag%
Xpath = //input[@placeholder='Categories and tags']
try driver.FindElementByXPath(Xpath).SendKeys(Tag)
catch e {
Message = Failed to input tag: %tag%
SaveOrPostProgress(Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
}
try driver.FindElementByXPath(Xpath).SendKeys(driver.Keys.ENTER)
if(A_index = 5)
Break
}
SaveOrPostProgress(Message:="Submitting Post",PostType:="Tooltip,ErrorLoggingTextFile")
; CLick the post button
Xpath = //button[normalize-space()='Post']
loop, 3 {
try driver.FindElementByXPath(Xpath).click()
sleep, 1500
} }
; Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=2000)
; sleep, 2000
; Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=2000) SaveOrPostProgress(Message:="Waiting 10 Seconds For Image to Upload",PostType:="Tooltip,ErrorLoggingTextFile")
sleep, 10000
}
; Input Tags
Xpath = //div[@class='search fastSearchShow']//input[@id='text']
TagsArray := StrSplit(PostTags, ",")
TagsArrayLength := TagsArray.Length() ; Save total number of items in the array
loop, %TagsArrayLength% {
Tag := TagsArray[A_Index]
Tag := StrReplace(Tag, " ", "")
DevModeMsgBox(Tag)
; Tag = %Tag%
Xpath = //input[@placeholder='Categories and tags']
try driver.FindElementByXPath(Xpath).SendKeys(Tag)
catch e {
Message = Failed to input tag: %tag%
SaveOrPostProgress(Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
}
try driver.FindElementByXPath(Xpath).SendKeys(driver.Keys.ENTER)
if(A_index = 5)
Break
}
SaveOrPostProgress(Message:="Submitting Post",PostType:="Tooltip,ErrorLoggingTextFile")
if (ConfirmBeforeSubmit && ConfirmBeforeSubmitMsgboxFunc() != true) {
Message = User Selected STOP button when asked for confirmation. Cancelling Rest of Site Upload.
SaveOrPostProgress(Message:=Message, PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
return
}
; CLick the post button
Xpath = //button[normalize-space()='Post']
loop, 3 {
try driver.FindElementByXPath(Xpath).click()
sleep, 1500
}
; Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=2000)
; sleep, 2000
; Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=2000)
/* if(Status){ /* if(Status){
Message = Failed to Submit Post Message = Failed to Submit Post
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")

View File

@@ -88,6 +88,13 @@ if(Status){
; Click the final "post" button ; Click the final "post" button
SaveOrPostProgress(Message:="Submitting Post",PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:="Submitting Post",PostType:="Tooltip,ErrorLoggingTextFile")
if (ConfirmBeforeSubmit && ConfirmBeforeSubmitMsgboxFunc() != true) {
Message = User Selected STOP button when asked for confirmation. Cancelling Rest of Site Upload.
SaveOrPostProgress(Message:=Message, PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
return
}
Xpath = //*[@id="gabsocial"]/div/div[2]/div[2]/main/div/div[3]/div/div Xpath = //*[@id="gabsocial"]/div/div[2]/div[2]/main/div/div[3]/div/div
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=2000) Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=2000)
if(Status){ if(Status){

View File

@@ -106,6 +106,13 @@ sleep, 500
SaveOrPostProgress(Message:="Submitting Post",PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:="Submitting Post",PostType:="Tooltip,ErrorLoggingTextFile")
sleep, 2000 sleep, 2000
if (ConfirmBeforeSubmit && ConfirmBeforeSubmitMsgboxFunc() != true) {
Message = User Selected STOP button when asked for confirmation. Cancelling Rest of Site Upload.
SaveOrPostProgress(Message:=Message, PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
return
}
; Click post button ; Click post button
Xpath = //span[normalize-space()='Post'] Xpath = //span[normalize-space()='Post']
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=10,SleepLength:=1000) Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=10,SleepLength:=1000)

View File

@@ -168,7 +168,7 @@ if(ImageAttachmentFilepath != ""){
SaveOrPostProgress(Message:="Waiting 5 seconds for Image to finish uploading",PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:="Waiting 5 seconds for Image to finish uploading",PostType:="Tooltip,ErrorLoggingTextFile")
sleep, 5000 sleep, 5000
*/ */
} }
@@ -200,42 +200,38 @@ loop, 3 {
; Continue ; Continue
} }
/* if(!Status){ ; if BLANK if(InStr(PostTitleAndBody, "http") OR InStr(PostTitleAndBody, "www")){
Message = Post Failed: Failed to input Post for some reason Message = Waiting 10 seconds for Preview to Get Fetched
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
SaveDriverURLOFErrorPage() sleep, 10000
Return }
} else, {
*/ sleep, 2000
; sleep, 2000 }
if(InStr(PostTitleAndBody, "http") OR InStr(PostTitleAndBody, "www")){
Message = Waiting 10 seconds for Preview to Get Fetched
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
sleep, 10000
}
else, {
sleep, 2000
}
SaveOrPostProgress(Message:="Submitting Post",PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:="Submitting Post",PostType:="Tooltip,ErrorLoggingTextFile")
if (ConfirmBeforeSubmit && ConfirmBeforeSubmitMsgboxFunc() != true) {
Message = User Selected STOP button when asked for confirmation. Cancelling Rest of Site Upload.
SaveOrPostProgress(Message:=Message, PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
return
}
Xpath = //span[normalize-space()='Post'] ; Click the final "post" button Xpath = //span[normalize-space()='Post'] ; Click the final "post" button
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000) Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000)
if(Status){ if(Status){
Jscheck = return document.querySelector("div[aria-label='Text editor for creating content']").textContent ; Grabb innertext Jscheck = return document.querySelector("div[aria-label='Text editor for creating content']").textContent ; Grabb innertext
try TextContent := driver.executeScript(Jscheck) try TextContent := driver.executeScript(Jscheck)
Message = Failed to Submit Post Message = Failed to Submit Post
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Message = Failed to Submit Post: Text Content that got input: %TextContent% Message = Failed to Submit Post: Text Content that got input: %TextContent%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
SaveDriverURLOFErrorPage() SaveDriverURLOFErrorPage()
Return Return
} }
/* ; Keep trying to click the home button until able to and then move on to next site because sometimes it takes a while for a post to upload /* ; Keep trying to click the home button until able to and then move on to next site because sometimes it takes a while for a post to upload
Xpath = //span[normalize-space()='Home'] Xpath = //span[normalize-space()='Home']

View File

@@ -91,6 +91,11 @@ if(ImageAttachmentFilepath != ""){
} }
Message = Submitting Post Message = Submitting Post
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
if (ConfirmBeforeSubmit && ConfirmBeforeSubmitMsgboxFunc() != true) {
Message = User Selected STOP button when asked for confirmation. Cancelling Rest of Site Upload.
SaveOrPostProgress(Message:=Message, PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
return
}
; Click Publish post ; Click Publish post
js = document.getElementsByName('submitPost')[0].click(); ; Send content through javascript (Great for getting around emoji chrome limitaitons) js = document.getElementsByName('submitPost')[0].click(); ; Send content through javascript (Great for getting around emoji chrome limitaitons)
@@ -111,31 +116,20 @@ Return
} }
/* ; Double check that post got submitted
js = return document.querySelector("#body").value
Status := driver.executeScript(js)
if(Status != ""){
Message = Error: Post Failed to Submit for some reason
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
*/ IniWrite, Successful, %StatusFileFilePath%, Status, Locals
AddToTotalPostsPostedCount()
IniWrite, Successful, %StatusFileFilePath%, Status, Locals
AddToTotalPostsPostedCount()
SaveOrPostProgress(Message:=Message,PostType:="Tooltip")
PauseBetweenPosts()
DevModeMsgBox("done!")
Message = Post Publish Successful
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Return SaveOrPostProgress(Message:=Message,PostType:="Tooltip")
; -------------------------------/Locals------------------------------- PauseBetweenPosts()
DevModeMsgBox("done!")
Message = Post Publish Successful
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Return
; -------------------------------/Locals-------------------------------

View File

@@ -35,15 +35,6 @@ if(Status){
Return Return
} }
; DevModeMsgBox("popup activated?")
; click into popup box to make sure it's activated
/*xpath = //div[@class='ql-editor ql-blank']//div
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
DevModeMsgBox(Status)
*/
; DevModeMsgBox("inputting post now after clickng")
; input post title and body with javascript ; input post title and body with javascript
JsToExecute = document.querySelector(".ql-editor").innerText = '%JSPostTitleAndBody%'; JsToExecute = document.querySelector(".ql-editor").innerText = '%JSPostTitleAndBody%';
@@ -103,6 +94,11 @@ if(ImageAttachmentFilepath != ""){
sleep, 10000 sleep, 10000
} }
if (ConfirmBeforeSubmit && ConfirmBeforeSubmitMsgboxFunc() != true) {
Message = User Selected STOP button when asked for confirmation. Cancelling Rest of Site Upload.
SaveOrPostProgress(Message:=Message, PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
return
}
; Click the "Post" button ; Click the "Post" button
SaveOrPostProgress(Message:="Submitting Post",PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:="Submitting Post",PostType:="Tooltip,ErrorLoggingTextFile")
@@ -119,11 +115,6 @@ IniWrite, Successful, %StatusFileFilePath%, Status, MeWe
AddToTotalPostsPostedCount() AddToTotalPostsPostedCount()
PauseBetweenPosts()
DevModeMsgBox("done!")
Message = Post Publish Successful Message = Post Publish Successful
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")

View File

@@ -173,6 +173,11 @@ else, { ; otherwise, input just text
; sleep, 2000 ; sleep, 2000
SaveOrPostProgress(Message:="Submitting Post",PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:="Submitting Post",PostType:="Tooltip,ErrorLoggingTextFile")
if (ConfirmBeforeSubmit && ConfirmBeforeSubmitMsgboxFunc() != true) {
Message = User Selected STOP button when asked for confirmation. Cancelling Rest of Site Upload.
SaveOrPostProgress(Message:=Message, PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
return
}
loop, 3 { loop, 3 {

View File

@@ -65,59 +65,47 @@ else, {
try, driver.switchToalert().accept() ; if text exists Steemit will pop up menu asking for confirmation for clearing try, driver.switchToalert().accept() ; if text exists Steemit will pop up menu asking for confirmation for clearing
} }
/*
*/
Message = Inputting Post Content
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
; Input title
Xpath = //input[@placeholder='Title']
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000,StringTextContent:=PostTitle)
if(Status){
Message = Login Expired. Please log back in
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
Xpath = //textarea[@placeholder='Write your story...']
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
}
/* if(Status){ if(ImageAttachmentFilepath != ""){
Message = Post Failed, Please check login status Message = Attaching Thumbnail
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
Return
}
; Click "Accept" popup that asks if you're sure you want to clear post
try, driver.switchToalert().accept()
*/ Xpath = //input[@type='file']
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=ImageAttachmentFilepath)
if(Status){
Message = Failed to attach Image
Message = Inputting Post Content SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") SaveDriverURLOFErrorPage()
Return
}
; Input title
Xpath = //input[@placeholder='Title']
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000,StringTextContent:=PostTitle)
if(Status){
Message = Login Expired. Please log back in
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
Xpath = //textarea[@placeholder='Write your story...']
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
}
if(ImageAttachmentFilepath != ""){
Message = Attaching Thumbnail
SaveOrPostProgress(Message:=Message,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
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
/* /*
Xpath = //a[normalize-space()='selecting them'] Xpath = //a[normalize-space()='selecting them']
@@ -161,33 +149,35 @@ else, {
if(A_index = 8) ; Steemit only allows 8 tags if(A_index = 8) ; Steemit only allows 8 tags
Break Break
} }
/*
*/
if (ConfirmBeforeSubmit && ConfirmBeforeSubmitMsgboxFunc() != true) {
Message = User Selected STOP button when asked for confirmation. Cancelling Rest of Site Upload.
SaveOrPostProgress(Message:=Message, PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
return
}
Message = Submitting Post Message = Submitting Post
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
; Click Submit Button ; Click Submit Button
Xpath = //button[@type='submit'] Xpath = //button[@type='submit']
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000) Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
if(Status){ if(Status){
Message = Failed to submit Post Message = Failed to submit Post
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage() SaveDriverURLOFErrorPage()
Return Return
} }
IniWrite, Successful, %StatusFileFilePath%, Status, Steemit IniWrite, Successful, %StatusFileFilePath%, Status, Steemit
AddToTotalPostsPostedCount() AddToTotalPostsPostedCount()
Message = Post Publish Successful
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
PauseBetweenPosts()
DevModeMsgBox("done!")
Message = Post Publish Successful
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Return Return
;-----------------------/Steemit------------------------- ;-----------------------/Steemit-------------------------

View File

@@ -178,77 +178,68 @@ if(ImageAttachmentFilepath != ""){
Xpath = //input[@multiple='multiple'] Xpath = //input[@multiple='multiple']
driver.FindElementByXPath(Xpath).SendKeys(ImageAttachmentFilepath) driver.FindElementByXPath(Xpath).SendKeys(ImageAttachmentFilepath)
SaveOrPostProgress(Message:="Waiting 5 seconds for Image to finish uploading",PostType:="Tooltip,ErrorLoggingTextFile")
/* Xpath = //span[@class='trix-button-group trix-upload-buttons']//button[2] sleep, 5000
Status := Selenium_LoopToClickXpathAndWaitForOpenWindow(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000) }
if(Status){
Message = Failed to click on Picture Upload button
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
}
InputStatus := InputFilePathIntoOpenWindow(ImageAttachmentFilepath)
if(InputStatus = "Failed")
{
Message = Upload Failed:`nUnable to Find "Open File" window to input filepath into
SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile,DiscordErrorLogging")
Return
}
*/
SaveOrPostProgress(Message:="Waiting 5 seconds for Image to finish uploading",PostType:="Tooltip,ErrorLoggingTextFile")
sleep, 5000
}
; Click the post Button ; Click the post Button
SaveOrPostProgress(Message:="Submitting Post",PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:="Submitting Post",PostType:="Tooltip,ErrorLoggingTextFile")
; post button at bottom right corner ; post button at bottom right corner
Selector = ".flat_button.for-post_form" Selector = ".flat_button.for-post_form"
; check if post button exists ; check if post button exists
js = return document.querySelector(%Selector%).innerText js = return document.querySelector(%Selector%).innerText
try, Status := driver.executeScript(js) try, Status := driver.executeScript(js)
if(!Status){ if(!Status){
Message = Post Failed. Unable to find Post button using usual method. Message = Post Failed. Unable to find Post button using usual method.
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage() SaveDriverURLOFErrorPage()
Return Return
} }
else, { else, {
Message = Post Button Exists and has the text: %Status% Message = Post Button Exists and has the text: %Status%
SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile,DiscordErrorLogging")
} }
; click submit button
js = document.querySelector(%Selector%).click()
try, Status := driver.executeScript(js)
; Msgbox % "Status: " Status
sleep, 2000 SaveOrPostProgress(Message:="Submitting Post",PostType:="Tooltip,ErrorLoggingTextFile")
if (ConfirmBeforeSubmit && ConfirmBeforeSubmitMsgboxFunc() != true) {
Message = User Selected STOP button when asked for confirmation. Cancelling Rest of Site Upload.
SaveOrPostProgress(Message:=Message, PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
return
}
; check if post button still exists ; click submit button
js = return document.querySelector(%Selector%).innerText js = document.querySelector(%Selector%).click()
try, Status := driver.executeScript(js) try, Status := driver.executeScript(js)
if(Status){ ; Msgbox % "Status: " Status
Message = Post Failed. Failed to click Post button using usual method.
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") sleep, 2000
SaveDriverURLOFErrorPage()
Return ; 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
}
; 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')] /* Xpath = //button[contains(text(),'Post')]

View File

@@ -108,7 +108,22 @@ if(ImageAttachmentFilepath != ""){
sleep, 5000 sleep, 5000
} }
/*; Get User confirmation if they have the setting checked
if(ConfirmBeforeSubmit){
Status := ConfirmBeforeSubmitMsgboxFunc()
if(Status){
Message := Status
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return
}
}
*/
if (ConfirmBeforeSubmit && ConfirmBeforeSubmitMsgboxFunc() != true) {
Message = User Selected STOP button when asked for confirmation. Cancelling Rest of Site Upload.
SaveOrPostProgress(Message:=Message, PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
return
}
; Click on "Post" button ; Click on "Post" button
sleep, 2000 sleep, 2000