Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

108
Views
p5.js autoclicker calling

I have a simple question maybe, I was for days looking for solution and don't want to waste your time, but isn't work for me so I'm here now.

Im using P5JS, and I wanted to create auto click function. There how I call an button in sketch.js file

 var button1 = createButton("Generator");
  button1.mousePressed(banana);
  button1.id('autoclick');

Here you can see how I call in index.html Im trying something like this:

    <script type="text/javascript">
var iteration = true;
var time = new Date();
var delay = 5000; // 5 secondes

while(iteration) {
    if(time.getTime() + 5000 < new Date().getTime()) {
         iteration = false;
    }
}
document.getElementByID('autoclick').click();
      // noprotect
</script>

Maybe I complicate to much? any suggetions? thank you!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Your while loop is blocking, which means that while Javascript is running your while loop, it will not be able to execute any other code. You want to use setInterval() for your purposes.

For example,

setInterval(() => console.log("hello!"), 1000)

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!