Forum Discussion
Functionality for printing in Storyline
Just to clarify my understanding, by "print" you actually mean download? Clicking a link in the resource tab (for me) just downloads the file, after which then the user obviously retains the choice to open and print any downloaded documents.
If that's your goal, then you're in luck, yes.
When I hover over a file uploaded to the resource tab, I can see the thing I can click is itself a button that contains the JavaScript
DS.windowOpen.open({ url: 'story_content/external_files/myDoc.docx' })
That same code can be added to a trigger that Executes when the user clicks a button of our choice, and the file will similarly download as if the learner had clicked the Resources item.
A more direct answer to your question could be to have one trigger for each downloadable file, all of which trigger when the Download Cart button is pressed, and then give each of those triggers a condition that checks if it was added to the cart. You mentioned a true/false variable being toggled when they add it to their cart, so those would be perfect to leverage.
Any resources the learner didn't add to their cart would have their download JS skipped when the user clicks the button. If you have a lot of documents and/or want to keep the number of triggers low and/or want to flex your JS, consider a single Execute JavaScript trigger containing something like
if (getVar('JA1Added')) DS.windowOpen.open({ url: 'story_content/external_files/JA1.docx' });
if (getVar('JA2Added')) DS.windowOpen.open({ url: 'story_content/external_files/JA2.docx' });
if (getVar('JA3Added')) DS.windowOpen.open({ url: 'story_content/external_files/JA3.docx' });
The most amount of labor will probably be collecting all of the hyperlinks shown in the Resources dropdown, though notice in the URL that they're all just the file's name.
Lemme know if it works for you.
- KristenNichols23 days agoCommunity Member
This makes sense! I'm not great with JS but I understand what you're saying. I'll give it a try, thank you very much.
Related Content
- 4 months ago
- 22 days ago
- 11 months ago