do once on resume

Sep 22, 2023

Hi,

I'd like to do something once (execute a javascript) if the user chose to resume after launching (and therefore not do it if new launch or restart).  I need it to happen once no matter what slide the user resumes to; for performance reasons, I don't want it to execute on every slide as would happen if I put the javascript in the master slide (which would be a way to make sure it executed no matter what slide the user resumed to). Is there any way to know if the user clicked Resume?  I asked the latest AI language model and it made up a built-in variable that does not exist :-(  Is there a way to find out if the user clicked Resume?

Thanks

7 Replies
David Kelling

Ron, I understand you are suggesting I set a variable to True if the user clicks Resume in Storyline's built-in resume prompt.  What built-in Storyline variable changes to True if the user clicks Resume in the built-in resume prompt, so I can set my variable to True?  (If there was such a variable, I wouldn't need mine!) What is the name of that built-in Storyline variable you are suggesting exists?  You are suggesting there is a way for me to know the user clicked Resume. Again, you said (emphasis mine): "You could create your own True/False Variable that gets set to True when Resume is selected"   How do I know Resume got selected? Thanks, David

Nedim Ramic

I think this JavaScript code should do the trick:

const resumed = document.querySelector('[data-dv_ref="resume"]');
  if (resumed) {
    GetPlayer().SetVar('Resumed', true)
  } 

In your project, create a variable (eg. Resumed). set it to False. Execute JavaScript When the timeline starts on this slide. When you launch the course for the first time, "Resumed" will be False because the Resume button is not yet visible, When you reload the course, the Resume button shows and turn the "Resumed" variable to True when the course is resumed. You should probably place the Execute JavaScript trigger in the Master slide.  Your "Resumed" variable will keep its value throughout the course unless you change it on purpose.

David Kelling

To anyone else that reads this (Particularly Articulate staff!) I'd like to know if there is a better way. I'm skeptical this will be reliable long-term as Articulate might change how the Resume button is rendered in the future, given the continually changing landscape of browsers and devices. I would love to know if there is another way, that relies on code (an unadvertised built-in variable?) that has been there for years and therefore will likely be there for years to come.