Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

How to paste content of a variable to clipboard in SC 2 in Twine 2

I am using Sugarcube 2 in Twine 2.

I would like the user to paste a blob of text generated in a passage onto the clipboard so that he/she can save it as per their choice (email, in a word document, etc.)
How can I save value of a variable to system clipboard?

Additionally, how can i give an email button, which when clicked opens up local email client and populates basic fields (to, cc, subject, and body). This way user can easily share results with others.

Thanks in advance for your inputs.

Comments

  • I have no idea about the clipboard question, but for an email button you just need to make a link:

    <a href="mailto: destination@pop.com">

    For populating basic fields you should google about, I have no idea, but there are plenty of examples in the web.

    Try this:
    http://www.w3schools.com/html/html_forms.asp

    And this:
    http://www.w3schools.com/html/tryit.asp?filename=tryhtml_form_mail
  • twinesims wrote: »
    I would like the user to paste a blob of text generated in a passage onto the clipboard so that he/she can save it as per their choice (email, in a word document, etc.)
    How can I save value of a variable to system clipboard?
    You cannot, not directly at any rate. It would be easiest to use something like Clipboard.js and then print the value of your variable as part of a link or button.
    twinesims wrote: »
    Additionally, how can i give an email button, which when clicked opens up local email client and populates basic fields (to, cc, subject, and body). This way user can easily share results with others.
    Taking a look at a description of mailto URIs might be helpful to start with.


    I'll attach a Twine 2 archive of an example project (including Clipboard.js) which shows an example of how you might do both.
  • Thanks for the inputs
Sign In or Register to comment.