Is there a way to skip the dialog box when running online?

Thanks @Luke awesome code. Just for anyone who will stumble across that post in the future, the id of the “OK”-button seems to have changed, so now the following code works (all the credit goes to @Luke)

var checkOK = setInterval(function() { //Use basic nested setInterval for Status check of dialog
    console.log("Check if DialogBox loaded");
   if (document.getElementById("progressMsg")) { //Wait for ProgressMsg to exist
        console.log("Dialogbox exists."); //Dialog Box Ready
      var statusText = document.getElementById("progressMsg").innerHTML; //get Status of ProgressMsg
      if(statusText == "all resources downloaded.") //If status is good. Go and let JS Click the button
      {
      console.log("All resources were downloaded! Press Ok now...");
      document.getElementById("dialogOK").click(); // Click on the checkbox
      clearInterval(checkOK);
      }
   }
}, 500); // check every 500ms

//Source: https://discourse.psychopy.org/t/is-there-a-way-to-skip-the-dialog-box-when-running-online/25625/2

The line document.getElementById("buttonOK").click(); now is document.getElementById("dialogOK").click();

Cheers to anyone, who might find that in the future :slight_smile:

1 Like