|
CALCULATING THE DURATION OF A QUIZ
Need to know
how long it took the user to complete your quiz? Unfortunately
ToolBook does not have any built in feature to tell you this information
so you have to figure it out yourself.
In OpenScript,
there are a variety of ways to calculate the duration, but if you want to
export to DHTML your options are very limited in how to approach this
task.
One way would
be to use the Date and Time fields from the Text Fields catalog category.
Since those auto-Update with current information it is possible to read
the text of those fields and do the complex math of churning out a
duration.
I decided to
take a different approach. The Action Timer catalog object has the ability
to report the current time in milliseconds. So, if you put one of these on
your first page to acquire the Start time, and also one on your last page
to acquire the end time, you can fairly easily subtract the difference and
know the total milliseconds that have passed.
Using a little
more math you can convert the milliseconds to seconds or something even
better such as a time displayed in the format of hh:mm:ss.
This sample
does just that, working both in Native ToolBook as well as DHTML.

DOWNLOAD DURATION.ZIP

-
This
download contains one .TBK file.
-
You can
examine how it works, by looking at all the Actions Editor code. You
may find it useful to use the Tools menu to access the Dump Book
Actions option in order to see all the code I wrote.
-
Download
this 47K file | 8.5/8.6
| 2004
| 9.0
|