About the author
Sometimes, if you're away, or out of touch, and you need to click a button on a web page around or after a specific time, you just have no choice but to come up with a script to do it.
This is what happened to me, when I need to click a button after a specific time, but I wasn't around to do it.
I decided to schedule a button click by writing Javascript and injecting it into the website I was using.
var myButton = temp0; var myDate = 4; var myHH = 7; var myMM = 15; // change all values here var C=0; if (myButton!=null) { myButton.textContent="Post D"+myDate+" H"+myHH+" M"+myMM+" C"+C; } var Interval1 = window.setInterval(function(){ // Set interval for checking C=C+1; if (myButton!=null) { myButton.textContent="Post D"+myDate+" H"+myHH+" M"+myMM+" C"+C; } var date = new Date(); // Create a Date object to find out what time it is console.log("Waiting for day " + myDate + " " + myHH+":"+myMM + " evaluating " + myButton.textContent); if (date.getDate() < myDate) { console.log("Returning..." + new Date()); return; } console.log("Current date..." + new Date()); if(date.getHours() >= myHH && date.getMinutes() >= myMM && myButton != null){ // Check the time // Do stuff console.log("Button clicked..." + new Date()); myButton.click(); myButton = null; window.clearInterval(Interval1); } else { console.log("Not time yet."); } }, 60000); // Repeat every 60000 milliseconds (1 minute)
How to free more space on your home drive by redirecting the location for SDKs in RAD Studio