Submit Result Trigger at a Specific Daily Time

Hi all,

I am working on a project with a requirement of a specific actual exam time. It is quite a challenge as the SL360 only supports the Quiz Timer which is not the right concept. Our practice is that we want to set a Javascript or any possible trigger to alert our students every time their exam was up at 5 pm daily. Then, they will direct to the exam result slide and their exam result will submit automatically.

Sorry, I am pretty new to Java and really have no idea how to write them from scratch. Any help is appreciated...!

13 Replies
Uychhorng Khan

Hi Raj,

Thank you so much for your answer. I'm quite new to this tool and really don't know much about this interval function. Would you mind show me how to get it done?

PS: I had done some javascript and embedded it in the master slide to pull out the actual system time on each slide but I don't know how to trigger that system clock to jump to Result Slide when it comes to my specific time. Below is my system clock script:

var currentTime = new Date()
var month = currentTime.getMonth() + 1
var day = currentTime.getDate()
var year = currentTime.getFullYear()
var hour = currentTime.getHours();
var minute = currentTime.getMinutes();
var timeString=hour + ":" + minute;
var player = GetPlayer();
player.SetVar("SystemTime",timeString);
Raj S

HI Uychhorng,

I have updated the script below, please use the same in slide master javascript

 

var myVar = setInterval(myTimer, 1000);
var flag = true;
function myTimer() {
var currentTime = new Date()
var month = currentTime.getMonth() + 1
var day = currentTime.getDate()
var year = currentTime.getFullYear()
var hour = currentTime.getHours();
var minute = currentTime.getMinutes();
var timeString=hour;

if (timeString=="12"|| timeString == 12 && flag== true){
flag = false;
myStopFunction();
var player = GetPlayer();
player.SetVar("SystemTime",timeString);
}

}

function myStopFunction() {
clearInterval(myVar);
}

Now  you need to add the another Trigger in Master slide

jump to result slide when variable changes and select "timeString" variable and add if condition . you need to select timeString== 12;

 

I hope this should work.

Regards

Raj

 

Uychhorng Khan

Hi Raj,

Would you mind if I ask you a question about this updated code? I am wondering about this part:

What does it mean? Does it mean that the timeString flag will change (equal to 12 pm or after 12 pm onward?) then the variable will flag as "false"?

Thanks,

Chhorng

if (timeString=="12"|| timeString == 12 && flag== true){
flag = false;
myStopFunction();
var player = GetPlayer();
player.SetVar("SystemTime",timeString);
}

}

function myStopFunction() {
clearInterval(myVar);
}
Uychhorng Khan

Thank you so much, Raj. So the time here needs to be in 24hrs format or we can put 12hrs format? and what if there is a specific minute? and what happens if the learner just starts after 5pm?

Can I write it like this?

if (timeString>="17:30"|| timeString >= 17:30 && flag== true){
flag = false;
myStopFunction();
var player = GetPlayer();
player.SetVar("SystemTime",timeString);
}

}

function myStopFunction() {
clearInterval(myVar);
}
Uychhorng Khan

Hi Raj,

Your provided code was perfectly worked. But, when I tried to change the value it didn't work. Not sure I am doing it the right way or not.

Could you please advise?

PS: I also made a change about the "if condition" of timeString=1130 as well.

var myVar = setInterval(myTimer, 1000);
var flag = true;
function myTimer() {
var currentTime = new Date()
var month = currentTime.getMonth() + 1
var day = currentTime.getDate()
var year = currentTime.getFullYear()
var hour = currentTime.getHours();
var minute = currentTime.getMinutes();
var timeString=hour + minute ;

if (timeString>="1130"|| timeString >= 1130 && flag== true){
flag = false;
myStopFunction();
var player = GetPlayer();
player.SetVar("SystemTime",timeString);
}

}

function myStopFunction() {
clearInterval(myVar);
}
Raj S

Try this.

 

var myVar = setInterval(myTimer, 1000);
var flag = true;
function myTimer() {
var currentTime = new Date()
var month = currentTime.getMonth() + 1
var day = currentTime.getDate()
var year = currentTime.getFullYear()
var hour = currentTime.getHours();
var minute = currentTime.getMinutes();


hour = String(hour);
minute = String(minute);
var timeString= hour +minute ;

if (timeString>="1130"|| timeString >= 1130 && flag== true){
flag = false;
myStopFunction();
var player = GetPlayer();
player.SetVar("SystemTime",timeString);
}

}

function myStopFunction() {
clearInterval(myVar);
}

Uychhorng Khan

Hi Raj,

Thank you so much for your fantastic support. It's WORKED now. And this is the latest code I used.

PS: the only thing issue is that it is called the system time so when the user changed the device time, they still manage to do the test.

var myVar = setInterval(myTimer, 1000);
var flag = true;
function myTimer() {
var currentTime = new Date()
var month = currentTime.getMonth() + 1
var day = currentTime.getDate()
var year = currentTime.getFullYear()
var hour = currentTime.getHours();
var minute = currentTime.getMinutes();

hour = String(hour);
minute = String(minute);
var timeString = hour + minute;

timeString = Number(timeString);
var timeNumber = timeString;

if (timeNumber >= 1310 || timeNumber>= 1200 && flag == true){
flag = false;
myStopFunction();
var player = GetPlayer();
player.SetVar("SystemTime",timeNumber);
}

}

function myStopFunction() {
clearInterval(myVar);
}