Creating Dynamic Dates in Storyline

Jun 04, 2015

Hi there,

 

Just thought I'd share, since I didn't find this elsewhere.  I currently design courses in which the learner looks at example customer orders, and the question came up of a way to use screenshots but have the dates change so they don't become outdated.  Dates would need to have the full month name printed, not just the month #.  So, I grabbed a screen, whited out the dates, and went into some coding. 

 

By using blank text variables on the slide combined with Execute JavaScript  on timeline start triggers, it was able to create the effect I wanted!

 

Here is the javascript coding that I’ve made for getting today’s date to print, which can be called out by  using the variable %systemdate%:

 

http://pastie.org/10223968

 

Here’s the code for generating "other" dates (modify the – 5 and +25 to set how many days ago – they always add to 30) and called out in this example with %shipdate% (you can modify that name on the final line to use a different variable:

 

 http://pastie.org/10223966

 

9 Replies
Sylvia Wright

Jason, can you (or someone from the community) tell me how to set up the variable so that the javascript will work, PLEASE?  I have a certificate at the end of my course and I'd like to have the date dynamic so that the certificate is current with the user completing the course.  I created a trigger for the javascript and entered what you gave and created a variable called systemdate, but not sure what kind of variable to make it etc.  Yikes....so much still to learn with this amazing program.  THANKS!!!

Sylvia Wright

Hi Matthew,

 

Thanks so much for the input!  I've tried everything I can think of.  I get the message when I preview that says can't view the javascript, but when I publish there is still nothing visible.  I've tried moving it up the "ladder of operations". I've tried putting the trigger on the layer where I have the reference and I've tried putting the trigger on the object that triggers the layer, but it just doesn't show anything when published. I used the code from here https://www.articulate.com/support/storyline/javascript-best-practices-and-examples for the dynamic date, but just can't get it to show when published.  I tried the html version and the html5 version. ????

When I try it on the Mac side of my computer a message comes up that my browser does not support the javascript.  I get the same message on Safari and Firefox.  I've tried unchecking the block pop-ups and made sure that Ghostery is paused and any java addons are always active.  Sigh.

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