From e810133ff5dc34c755489630472f6c15414981f9 Mon Sep 17 00:00:00 2001 From: Yuriy Date: Fri, 11 Oct 2024 23:49:10 -0400 Subject: [PATCH] Added workaround to fix Subscribestar broken Hyperlink inputting. --- Modules/Post-To-Subscribestar.ahk | 35 +++++++++++++++++++++++++------ Version.ini | 2 +- 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/Modules/Post-To-Subscribestar.ahk b/Modules/Post-To-Subscribestar.ahk index 6112fd0..7097ad1 100644 --- a/Modules/Post-To-Subscribestar.ahk +++ b/Modules/Post-To-Subscribestar.ahk @@ -146,13 +146,36 @@ 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 +if(InStr(PostBody, "http")){ + StrLengthOfPost := StrLen(PostBody) + + SaveOrPostProgress(Message:="Body has hyperlink, Inputting text key by key",PostType:="Tooltip,ErrorLoggingTextFile") + + Loop % StrLengthOfPost{ + + Current_Char := SubStr(PostBody, A_index, 1) + + Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=1,SleepLength:=20,StringTextContent:=Current_Char) + if(Status){ + Message = Failed to Input Text + SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") + SaveDriverURLOFErrorPage() + Return + } + } } +else, { + SaveOrPostProgress(Message:="Body has no hyperlink, inputting entire text body into element.",PostType:="Tooltip,ErrorLoggingTextFile") + + 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 diff --git a/Version.ini b/Version.ini index 38932e7..4a64933 100644 --- a/Version.ini +++ b/Version.ini @@ -1,2 +1,2 @@ [Social-Media-Poster] -Version=2.95 +Version=2.96