From 9b506a8f73a3c1076373782145b2cc6e573e7277 Mon Sep 17 00:00:00 2001 From: yuriy Date: Tue, 19 Dec 2023 03:37:20 +0000 Subject: [PATCH] Update 'Modules/Post-To-Bastyon.ahk' Added error handling to failed tag input --- Modules/Post-To-Bastyon.ahk | 42 ++++++------------------------------- 1 file changed, 6 insertions(+), 36 deletions(-) diff --git a/Modules/Post-To-Bastyon.ahk b/Modules/Post-To-Bastyon.ahk index e62a96f..1491c3f 100644 --- a/Modules/Post-To-Bastyon.ahk +++ b/Modules/Post-To-Bastyon.ahk @@ -148,47 +148,17 @@ if(Status = ""){ DevModeMsgBox(Tag) ; Tag = %Tag% Xpath = //input[@placeholder='Categories and tags'] - driver.FindElementByXPath(Xpath).SendKeys(Tag) - driver.FindElementByXPath(Xpath).SendKeys(driver.Keys.ENTER) - - ; driver.findElementsByClass("sminput").item[2].click() + try driver.FindElementByXPath(Xpath).SendKeys(Tag) + catch e { + Message = Failed to input tag: %tag% + SaveOrPostProgress(Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") + } - ; JsToExecute = document.querySelector("#text[placeholder='Add Categories/Tags']").value = "#%Tag%" - ; Status := JS_TryToExecute(JsToExecute) - ; - ; driver.SendKeys(driver.Keys.SPACE) - ; - ; JsToExecute = return document.querySelector("#text[placeholder='Add Categories/Tags']").value - ; Status := JS_TryToExecute(JsToExecute) + try driver.FindElementByXPath(Xpath).SendKeys(driver.Keys.ENTER) if(A_index = 5) Break - - - /*Tag := TagsArray[A_Index] - Tag := StrReplace(Tag, " ", "") - ; Tag = %Tag% - Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000,SendKeysContent:=Tag) - try driver.FindElementByXPath(Xpath).SendKeys(driver.Keys.Space) - - */ - ; if(A_index = 8) ; Steemit only allows 8 tags - ; Break } - ; msgbox - -/* Xpath = //div[@class='emojionearea-editor pastable'] - Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=3,SleepLength:=1000,StringTextContent:=PostTitleAndBody) - if(Status){ - SaveOrPostProgress(Message:="Failed to Input Post",PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") - Return - - ; Send, - } - */ - - - ; Msgbox,4096,Pause!!,asdf SaveOrPostProgress(Message:="Submitting Post",PostType:="Tooltip,ErrorLoggingTextFile")