How to make subtitles change automatically on youtube?⁣

//represents clicked buttons (to turn on and change subtitle)
const settinsgBtn = document.querySelector("#movie_player > div.ytp-chrome-bottom > div.ytp-chrome-controls > div.ytp-right-controls > button.ytp-button.ytp-settings-button.ytp-hd-quality-badge");
const translateBtn = document.querySelector("#movie_player > div.ytp-chrome-bottom > div.ytp-chrome-controls > div.ytp-right-controls > button.ytp-subtitles-button.ytp-button");
const langueContentBtn = document.querySelectorAll(".ytp-menuitem-content")[2];
const autoTranslateBtn = document.querySelectorAll(".ytp-menuitem-label")[2];
const myLangueBtn = document.querySelectorAll('.ytp-menuitem-label')[80]

//It checks every second whether the buttons are on the screen and clicks the button if there is.
//Each button makes another button appear on the screen.
const checkElements = setInterval(clicker, 1000);

let count = 1;
function clicker() {
    if (count === 1 && translateBtn) {; count++;
    else if (count === 2 && settinsgBtn) {; count++;
    else if (count === 3 && langueContentBtn) {; count++;
    else if (count === 4 && autoTranslateBtn) {; count++;
    else if (count === 5 && myLangueBtn) {; count = 0;


I want the youtube video to press the subtitle button and translate it into my language from the settings, but the variables are not defined immediately. If the button to be clicked is not visible at first, the variable returns undefined value. It works when I redefine the variable after the button appears. I tried without defining the variable but it again doesn’t work after the 2nd click.⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣


Path issue with passing a command from Autohotkey to PowerShell

The Nebulant CLI tool is a single binary that can be used as a helper for the web editor