Execute trigger when course starts/ends

Aug 09, 2012

I want to do some housekeeping, when my course session starts and when it ends. How can I connect a trigger to those events?

"Timeline starts" and "Timeline ends" seems to be associated with slides and not with the story as such. I believe, that even timeline events on a master slide is fired on a per slide basis.

Of course I could hook into LMSInitialize and LMSFinish in javascript, but then the export of the course gets very complicated.

5 Replies
Jørgen Nielsen

Perhaps I found my own solution:

- In my js-file I initiate the variable loadHandled to false

- On my masterslide(s) I create a trigger, that executes when timeline starts. The trigger is an execute-javascript trigger that calls the function handleLoad, that is in my js-file:

function handleLoad() {
 if (! loadHandled) {
  loadHandled = true;

The function will only do something when being called for the first time during a session. I can put any housekeeping into the if statement. The last statement in the if makes it possible to execute my own housekeeping, when the course session ends. I just have to create the function DoMyOnClose in the js file.

I will use this setup for persisting variables to the LMS. The handleLoad function can read the variables from say lesson_location and initiate the Storyline variables via SetVar. The DoMyOnClose function can compress the variabels into an array and write a string-version of that to the LMS.

Any comments?

Jørgen Nielsen

When I try to write to the LMS in my DoMyOnClose function, I get error 7, "Cannot make calls to the LMS before calling start". I then added window["onbeforeunload"]=function(){DoMyOnClose();DoOnClose();}; to my handleLoad function, but the problem with the error is still there.

Any suggestions will be most wellcome!

This discussion is closed. You can start a new discussion or contact Articulate Support.