I tried applying this using ChatGPT, but it didn't work for me. Can you tell me where to put this code to make my code work?
// Функция для эмуляции нажатия мыши внутри элемента <canvas data-sentry-element="Stage"> function simulateMouseClickInCanvas() { const canvas = document.querySelector('canvas[data-sentry-element="Stage"]'); if (!canvas) { console.error("Элемент <canvas> не найден."); return; } const rect = canvas.getBoundingClientRect(); // Выбираем случайные координаты внутри элемента <canvas> const randomX = Math.random() * rect.width + rect.left; const randomY = Math.random() * rect.height + rect.top; // Создаём события мыши const mouseDownEvent = new MouseEvent("mousedown", { bubbles: true, cancelable: true, clientX: randomX, clientY: randomY, }); const mouseUpEvent = new MouseEvent("mouseup", { bubbles: true, cancelable: true, clientX: randomX, clientY: randomY, }); const clickEvent = new MouseEvent("click", { bubbles: true, cancelable: true, clientX: randomX, clientY: randomY, }); // Эмулируем события canvas.dispatchEvent(mouseDownEvent); canvas.dispatchEvent(mouseUpEvent); canvas.dispatchEvent(clickEvent); } // Функция для выполнения кликов с рандомной задержкой function performRandomClicksInCanvas(maxClicks) { let clicksCount = 0; function clickWithRandomDelay() { if (clicksCount >= maxClicks) { console.log("Все клики выполнены"); return; } const delay = Math.random() * (2000 - 100) + 100; // Рандомная задержка от 0.1 до 2 секунд setTimeout(() => { simulateMouseClickInCanvas(); clicksCount++; console.log(`Клик ${clicksCount} выполнен (задержка: ${Math.round(delay)} мс)`); clickWithRandomDelay(); // Рекурсивный вызов для следующего клика }, delay); } clickWithRandomDelay(); } // Запуск выполнения 10 кликов performRandomClicksInCanvas(10);How to work with accounts ??
-
Hi everyone, i am already liking bas and its simplicity . Currently making a script for youtube and its working perfect for 1 account. My problem is how to iterate through account one by one using list , file or database . What i want to acheive is
- Use a account
- log and save cookie.
3.Do operations , clear everything
4.Use another account from list, file or database ( whichever is more efficient ) and repeat the steps.
Currently i am not worried about threads . Any hint or tutorial regarding this is highly appreciated .
-
@andy231 Welcome to BAS!
I've attached a sample script & files showing a few different ways for you. You'll being using "Phrase Line" and the most used delimiter for BAS is ":". When calling from a CSV files with any of the character basic delimiters for CSV files you want to wrap the cell with quotes so it knows it's one whole one.
To achieve selecting a new list item within a while/for/foreach, you want to uncheck "Reuse Resource" which will pull a new item from the resource after setting the variable.

Let me know if this was any help to you!
Allister☯
