Forum Discussion
BrettSchlagel-e
10 years agoCommunity Member
Copy Text Variable to Clipboard
I need some help.
I need users to be able to click a button to copy a text variable to their clipboard, which can then be pasted in a word doc. This doesn't necessarily have to be done through a ...
HollyMacDonald
Super Hero
Hi Matthew - I've just tested this and what ends up getting copied onto the clipboard is the javascript:
var player = GetPlayer();
var text= player.GetVar("copytext");
window.prompt("Copy to clipboard: Ctrl+C, Enter", text);
not the default text I put in the text variable. Do I need to put that text in the javascript?
If you have any insights, let me know!
ZsoltOlah
6 years agoSuper Hero
Here's an example on Project99 on how to copy text to the clipboard:
https://www.rabbitoreg.com/examples/p99/#/lessons/NPQ2NG0PlDgwjy_ZLbmw6t0PPaoWFEB6
Just change your variable name.
- HollyMacDonald6 years agoSuper Hero
Hi Zsolt - thanks for jumping in - Matthew's solution (above) worked. I was able to put the default text in the variable and then that is what was copied to the clipboard. I do love your Project99!