Use Current Date to Trigger Action

hplrsmom
Community Member Posts: 31
Greetings! I created a page with 12 images representing each month in a year. They will animate in as audio narration is playing. I could just animate them in one at a time starting with January, but it would be cool to start the graphic on the month that the course is accessed. So if it's accessed today, the first month to appear would be August, then populate through July. As a test, I created an OnShow action to show the August graphic if variable CurrentDate contained August. I also tried <August>. When those didn't work, I created a hidden text box to contain the current date and a ChangeContents action to update it with CurrentDate. None of these worked.
Once I determine that I can do that, I need to figure out the best way to trigger the proper order regardless of the month. My thought is to create one action group for each month that plays the images in order, then use the OnShow Action to determine which one to play. My concern is that it might take a long time to process that calculation. I'm open to ideas.
Once I determine that I can do that, I need to figure out the best way to trigger the proper order regardless of the month. My thought is to create one action group for each month that plays the images in order, then use the OnShow Action to determine which one to play. My concern is that it might take a long time to process that calculation. I'm open to ideas.
Comments
-
There seems to be a bug with the conditions panel... CurrentDate today contains "17.08.2017" (may be different where you are). If I check whether it contains "08" it works fine, only it would be true for "08.12.2017" as well. If I check for ".08" to make sure it can only be the month it won't work. It seems any "." in the value field breaks the code. CurrentDate equal to "17.08.2017" is not firing the action.
I attached a sample in that I'm using a tiny bit of custom javascript to check which month we currently have, but most of it is pure Lectora. -
Interesting. For me, CurrentDate displays "Thursday, August 8, 2017". I'm guessing the value is based on the Windows default format for Long Date, but I haven't tested to confirm.
In any case, once using JavaScript you can just use the JS Date() object as Tim as done. Alternatively, if there's some benefit to using Lectora's CurrentDate instead (I don't see one, but I wouldn't rule it out), this works:var dt = new Date(VarCurrentDate.value);
Categories
- 35.8K All Categories
- 109 ✫ Announcements
- 33.1K Lectora®
- 31.1K Lectora Discussions
- 28.9K Lectora Desktop
- 2K Lectora Online
- 2K Lectora Feature Requests
- 71 Lectora User Groups
- 36 Lectora Accessibility User Group (LAUG)
- 22 ELB Learning Content
- 22 ELB Learning Content Discussions
- 321 CenarioVR®
- 188 CenarioVR Discussions
- 133 CenarioVR Feature Requests
- 41 Rockstar Learning Platform®
- 38 Rockstar Learning Platform Discussions
- 108 CourseMill®
- 108 CourseMill Discussions
- 47 ReviewLink®
- 47 ReviewLink Discussions
- 7 The Training Arcade®
- 7 The Training Arcade Discussions
- 934 All Things eLearning
- 36 eLearning Development
- 546 Learning Management System (LMS) Integration
- 332 Web Accessibility
- 1.2K ♪ The Green Room
- 9 Additional Learning Products