This project is made fun. and you can control scratch's GUI! Script is on the NOTES! Please if THE URL IS NOT: https://scratch.mit.edu/projects/1176599666/ DONT COPY-PASTE IT TO YOUR CONSOLE! THIS SCRIPT IS RISK-FREE . YOU CAN TEST IT ON INCOGNITO/GUEST MODE.
// Function to click an element if it exists function clickElement(selector) { const element = document.querySelector(selector); if (element) { element.click(); return true; } return false; } // Check the URL first if (window.location.href !== "https://scratch.mit.edu/projects/1176599666/") { console.log("URL is not the target URL. Stopping script."); alert("Project is remixed! Redirecting...") window.location.href = 'https://scratch.mit.edu/projects/1176599666/' // alert("This script only runs on https://scratch.mit.edu/projects/1176599666/"); throw new Error("Incorrect URL"); // This will stop the script execution } // Main loop function runAutomation() { const monitorValueDiv = document.querySelector(".monitor_value_ZEFKO"); if (monitorValueDiv) { const VALO = monitorValueDiv.textContent.trim(); // Get the text content and remove whitespace console.log("Current VALO:", VALO); if (VALO === "love") { console.log("VALO is 'love'. Clicking project loves."); clickElement(".project-loves"); } else if (VALO === "fav") { console.log("VALO is 'fav'. Clicking project favorites."); clickElement(".project-favorites"); } else if (VALO === "pause") { console.log("VALO is 'pause'. Clicking pause button."); clickElement(".controls_controls-container_FKkXX > img.pause-btn"); } else if (VALO === "stop") { console.log("VALO is 'stop'. Clicking stop button."); clickElement(".controls_controls-container_FKkXX > img.stop-all_stop-all_pluqe"); } else if (VALO.includes("Redirect:")) { const redirectUrl = VALO.substring(VALO.indexOf("Redirect:") + "Redirect:".length).trim(); console.log("VALO includes 'Redirect:'. Redirecting to:", redirectUrl); try { // Ensure the URL is valid before redirecting new URL(redirectUrl); // This will throw an error if URL is malformed window.location.href = redirectUrl; } catch (e) { console.error("Invalid redirect URL:", redirectUrl, e); } } } else { console.log("Monitor value div not found. Retrying..."); } } // Run the automation every second (adjust as needed) const intervalId = setInterval(runAutomation, 1000); // Runs every 1000 milliseconds (1 second) console.log("Automation script started. Monitoring for changes..."); // Optional: To stop the script manually later in the console, you can run: // clearInterval(intervalId);