Submit Result Trigger at a Specific Daily Time
Oct 08, 2021
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
HI , you can do this by creating the set interval function to check the time and call a trigger to alert the user .
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:
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
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
Hi sorry , you can update 5.
Just for testing purpose I was using 12
i have used flag variable to make sure the function only calls one time
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?
Yes you can , just test it and see.
i hope it should work
Thank you so much, Raj. Will do it and share you the result soon. Again, thank you. _/\_
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.
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);
}
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.
You can integrate the server time and it should work
Thanks, Raj, I am exploring around about this Server time Javascripts but not sure I am in the right track. :D