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;
myDate = 4;
myHH = 7;
myMM = 15;
// change all values here
C=0;
if
(myButton!=
null
) { myButton.textContent=
"Post D"
+myDate+
" H"
+myHH+
" M"
+myMM+
" C"
+C; }
Interval1 =
window.setInterval(
function
(){
// Set interval for checking
C=C+1;
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);
(date.getDate() < myDate) {
"Returning..."
+
Date());
return
;
}
"Current date..."
(date.getHours() >= myHH && date.getMinutes() >= myMM && myButton !=
){
// Check the time
// Do stuff
"Button clicked..."
myButton.click();
myButton =
window.clearInterval(Interval1);
else
{
"Not time yet."
);
}, 60000);
// Repeat every 60000 milliseconds (1 minute)