In my advanced Storyline session at the ATD TechKnowledge conference people asked me if there's a way to copy text from a variable to the clipboard programmatically, so the user can paste it somewhere.
Thank you for sharing the link, Zsolt! I needed to string together several variables and static text, so I fiddled with the code. For anyone interested, I have a tutorial and the modified code here: https://www.klarichdesigns.com/2021/10/28/sl-clipboard/.
In my advanced Storyline session at the ATD TechKnowledge conference people asked me if there's a way to copy text from a variable to the clipboard programmatically, so the user can paste it somewhere.
Thanks got this Zsolt - just built an troubleshooter that sits in an iframe pop-up within one of our tools, and this JS copies some text across to an email which can then be sent straight to our IT dept when things go wrong. Super useful!
Last piece of the jigsaw. When the text is copied, in the top left of the browser it shows a text box with the copied text. I believe this is because the JS creates the textboc then copies its contents. So how can I get the textbox to delete after this has taken place?
Hello! Thank you for this function. I am planning to use it for my e-learning project. There's one question: if I want to have several lines in the text, how can I do that?
For example, there's a code I want my learners to copy like the following:
Hi Zsolt thank you so much for sharing this! I was hoping to ask if you have a way as well to paste text to a text entry with a live word count. Currently, I only configure my word count if the user starts typing. However when a text is copied and pasted in the text entry-- it does not recognize the word count anymore. Appreciate your help on this. Attached for your reference.
8 Replies
I got this to work in Storyline, but what about Rise? You definitely have it working in Rise on your site: https://www.rabbitoreg.com/examples/p99/#/lessons/NPQ2NG0PlDgwjy_ZLbmw6t0PPaoWFEB6 How did you do it??
Thank you for sharing the link, Zsolt! I needed to string together several variables and static text, so I fiddled with the code. For anyone interested, I have a tutorial and the modified code here: https://www.klarichdesigns.com/2021/10/28/sl-clipboard/.
Thanks much!
I'm glad you were able to create a solution, Crystal. I appreciate you chiming in to share, and welcome to E-Learning Heroes. 😊
Thanks got this Zsolt - just built an troubleshooter that sits in an iframe pop-up within one of our tools, and this JS copies some text across to an email which can then be sent straight to our IT dept when things go wrong. Super useful!
Last piece of the jigsaw. When the text is copied, in the top left of the browser it shows a text box with the copied text. I believe this is because the JS creates the textboc then copies its contents. So how can I get the textbox to delete after this has taken place?
Thanks for any help!
Hi Martin,
Yes, a new text box is created with the text, and the content is copied to the clipboard. We do not need that text box after. It can be deleted.
Oh, okay. The question was how.. Try this after the copy command:
1000 is a second delay. You can adjust that if you want.
Hello! Thank you for this function. I am planning to use it for my e-learning project. There's one question: if I want to have several lines in the text, how can I do that?
For example, there's a code I want my learners to copy like the following:
cd git-fundamental-repo01
echo "hello world" > file1.txt
cat file1.txt
How can I make it happen in just one click?
Hi Zsolt thank you so much for sharing this! I was hoping to ask if you have a way as well to paste text to a text entry with a live word count. Currently, I only configure my word count if the user starts typing. However when a text is copied and pasted in the text entry-- it does not recognize the word count anymore. Appreciate your help on this. Attached for your reference.