Добавил еще ведущие нули к миллисекундам, если кому-то еще когда-то этот код понадобится
log = function (text, color, define){ var id, time, thread, logHtml, textLog; define = (typeof define == 'string') ? define.split(/[\s,.|:;]+/g) : define; if(typeof define === 'object' && define !== null){ if(Array.isArray(define)){ id = define.indexOf('id') > -1; time = define.indexOf('time') > -1; thread = define.indexOf('thread') > -1; } else{ id = define.id == true; time = define.time == true; thread = define.thread == true; } } else id = time = thread = true; id = id ? '<a href="action://action' + ScriptWorker.GetCurrentAction() + '" style="color:gray;">[' + ScriptWorker.GetCurrentAction() + ']</a>' : ''; time = time ? ' ' + getTime() : ''; thread = thread ? ' Поток №' + thread_number() : ''; logHtml = (id || time || thread) ? id + '<span style="color: white">' + time + thread + ' : </span>' : ''; logHtml += '<span style="color:' + (color ? color : 'white') + '">' + text + '</span>'; textLog = '[' + ScriptWorker.GetCurrentAction() + ']' + time + thread + ' : ' + text function getTime(){ var checkTime = function(i){ return (i < 10) ? "0" + i : i; }; var checkMilliSeconds = function(ms){ if (ms < 10) { return "00" + ms; } else if (ms < 100) { return "0" + ms; } else { return ms; } }; var d = new Date(); var hh = checkTime(d.getHours()); var mm = checkTime(d.getMinutes()); var ss = checkTime(d.getSeconds()); var ms = checkMilliSeconds(d.getMilliseconds()); return '[' + hh + ':' + mm + ':' + ss + '.' + ms + ']'; }; Logger.WriteHtml(logHtml, textLog); }Как найти одну строчку в txt файле?
-
Как оставить в txt файле только 2 строчки которые идут сразу ниже после строчки URL: https://accounts.google.com/signin/v2/challenge/pwd
Может есть JS-скрипт как брать 2 строчки после текста:URL: https://accounts.google.com/signin/v2/challenge/pwdКак я делаю и не пойму ошибку:
Вот txt файл, в котором:=============== URL: https://store.steampowered.com/login/ Username: Scrgdfgcs Password: Nadfgdfs19 Application: Google_[Chrome]_Default =============== URL: https://www.crunchyroll.com/en-gb/welcome/login Username: u.sahhjgs@icloud.com Password: Marjghjgle2007 Application: Google_[Chrome]_Default =============== URL: https://accounts.google.com/signin/v2/challenge/pwd Username: u.ghjghjs@gmail.com Password: Ugjhghjg5s1 Application: Microsoft_[Edge]_Default ===============Как удалить всё, оставив только эти 2 строчки что идут ниже строчки акка гугла
URL: https://accounts.google.com/signin/v2/challenge/pwd
Пробую кубик "Читать файл" подсовывая txt и потом сопоставляю каждую строчку через IF
URL: https://accounts.google.com/signin/v2/challenge/pwd == foreachdata, проблема втом что читает файл не построчно, а в виде каждого символа (см ниже скрин)

-
Я придумал:
Файл - читать файл
Строка - получить подстроку между
Левую часть указываете "signin/v2/challenge/pwd"
Правую: Application: Microsoft_[Edge]_DefaultМожно для пущей необходимости полученную часть строки подровнять от переносов строки и пробелов "Строка" - Подровнять
-
Подсказали рабочий JS код, но он работает когда ему присвоен текст из переменной. Как в этот JSкод прописать переменную и чтоб после обработки он результат сохранил в туже переменную, сорри я в нуб в JS:
const regexpPattern = /accounts.google.com.*\n(.*)\n(.*)\n+/gi; const searchResult = inputText.matchAll(regexpPattern); const outputText = Array.from(searchResult) .map((arr) => `${arr[1]}:${arr[2]}`) .join("\n"); console.log(outputText);