Copy link to clipboard
Copied
I'm currently trying to build a button that will toggle hints (in the form of SmartShapes) and highlights that match a certain criteria from hidden to shown. Because the file is so big (over 600 slides), my current (attempted) approach has two parts.
First part is an Action on Enter for the first slide to Execute Javascript and find every item (highlights and smartshapes with text) that has "Anton_Resources_" in its name and creates a string with the names.
My second step was to create a button that I could drop on each page of the click through to toggle the hints on if needed. I hoped to do this by having a button that executes a javascript to loop through the string and show the objects in the list. (And then another script on exit of page to hide these objects again if the user still has more hints to use before going to "Beginner version" with all the hints and highlights shown for the rest of the simulation.)
These objects and shapes are scattered throughout the project on different pages. They are all named with the same naming convention (Hints are Hint_Anton_Resources_#### and Highlights are Highlight_Anton_Resources_####) so the only thing that changes is the number at the end (though they're not always consistent numbers due to copy and paste or edits along the way).
Ideally this code would work when published to my computer (to be able to confirm it works before sending to LMS). I am using Captivate 2017.
I've tried to find information on how to use cp.D or cp.model.data or even e.Data.si to put something together, but have had no luck and found no comprehensive source of information about how to use these. That said, at this point I just need to get a code that works!
Copy link to clipboard
Copied
I'm currently trying to build a button that will toggle hints (in the form of SmartShapes) and highlights that match a certain criteria from hidden to shown. Because the file is so big (over 600 slides), my current (attempted) approach has two parts.
First part is an Action on Enter for the first slide to Execute Javascript and find every item (highlights and smartshapes with text) that has "Anton_Resources_" in its name and creates a string with the names.
My second step was to create a button that I could drop on each page of the click through to toggle the hints on if needed. I hoped to do this by having a button that executes a javascript to loop through the string and show the objects in the list. (And then another script on exit of page to hide these objects again if the user still has more hints to use before going to "Beginner version" with all the hints and highlights shown for the rest of the simulation.)
These objects and shapes are scattered throughout the project on different pages. They are all named with the same naming convention (Hints are Hint_Anton_Resources_#### and Highlights are Highlight_Anton_Resources_####) so the only thing that changes is the number at the end (though they're not always consistent numbers due to copy and paste or edits along the way).
Ideally this code would work when published to my computer (to be able to confirm it works before sending to LMS). I am using Captivate 2017.
I've tried to find information on how to use cp.D or cp.model.data or even e.Data.si to put something together, but have had no luck and found no comprehensive source of information about how to use these. That said, at this point I just need to get a code that works!
Copy link to clipboard
Copied
Have you looked at Get name of element with JavaScript
Copy link to clipboard
Copied
I have but it did not work when I published it. I may have missed something from the larger thread, but putting the “correct“ code into the Execute JavaScript action for my button did not work.
Copy link to clipboard
Copied
Generally executing loops in the Execute JavaScript function will not work, it needs to be executed in an external JS file, which has a million other advantages.
Copy link to clipboard
Copied
Thanks for this TLC - figuring that might be what my issue is with the code from the thread Dan shared above. Is there a place I could go to learn how to set that up? It seems complicated.
Copy link to clipboard
Copied
I would use the CpExtra HTML5 widget from Tristan Ward in this case. Buy CpExtra | Infosemantics Pty Ltd
Copy link to clipboard
Copied
Indeed, Vico, that is what I answered by phone, but my answer never made it. Most users now think that they have to use JS where much easier solutions are available.