Register for our next webinar, 5 Keys to Unlock Storytelling in Your eLearning, where you'll learn how to unlock the magic of storytelling in your eLearning development to increase learner engagement and retention! Join Andrew Townsend, our Campaign Marketing Manager, on Thursday, December 3, 2020 at 11:00 AM MDT.

Be The First On Your Block to Rock Lectora® 21!


Apply for exclusive early access to the latest version of Lectora® Desktop v21. Seating is limited so make sure you apply now!

variable to clipboard

mbuitenkamp-4316mbuitenkamp-4316 Community Member Posts: 12
Hi all,

I'm looking for a way to copy the text from an entryfield to the clipboard, and combine it with a little bit of text of my own.

So, someone puts text in entryfield_1, that text gets stored in variable_1, and then with an onMouseClick I want that text and my own text copied to the clipboard, so it can be pasted into a document.

Any way of doing this?

Cheers in advance :)

Comments

  • wheelswheels Administrator Posts: 459 eLearning ROCKSTAR Stage Manager
    I've recently done something similar. I'm including an example that has a button and an entry field.

    It puts content into the entry field using a Change Contents action, then it runs some JavaScript to copy it to the clipboard.

    Hopefully it will be easy to understand, you need to Page Preview or Publish it for it to work.

    - Joe

    @mbuitenkamp.4316 (see the post below)
  • mbuitenkamp-4316mbuitenkamp-4316 Community Member Posts: 12
    Thank you for wanting to help!
    However, when I import the pkg, all I see is a blank page?
  • wheelswheels Administrator Posts: 459 eLearning ROCKSTAR Stage Manager
    It was blank, not sure how that happened.

    It also needed some updates, so it's a good thing. It will work on either Desktop or Online now.

    Thanks

    Joe
  • mbuitenkamp-4316mbuitenkamp-4316 Community Member Posts: 12
    awesome!! I got it to work in my document! Thank you!

    but... (of course there's a but), I need the entryfield to be multiline since we're asking users to create a list.
    that isn't a problem, until I paste the contents from the clipboard and the neat little list just ends up as one very long single line.

    so this:

    item 1
    item 2
    item 3

    becomes this:

    item 1item 2item 3
    Can that be fixed???
  • mbuitenkamp-4316mbuitenkamp-4316 Community Member Posts: 12
    edited to match my document, so you can see what's going on :)
  • mbuitenkamp-4316mbuitenkamp-4316 Community Member Posts: 12
    found it!

    it was actually just a matter of making the 'Set To Update Clipboard' to multiline as well.

    Yay, I'm so happy!
    thank you :D:D:D
  • mbuitenkamp-4316mbuitenkamp-4316 Community Member Posts: 12
    okay, last question:
    it works when the entryfield is single line, but it doesn't work when the entryfield is multiline

    The variable gets set into the entryfield for copy, but in multiline the text doesn't get selected, and so it doesn't get copied.
    Which is a shame because I really do need a multiline solution.

    Any idea how to fix this?

    tia :)
  • wheelswheels Administrator Posts: 459 eLearning ROCKSTAR Stage Manager
    Hi Tia,

    That's great you are figuring it out!

    You need to change the execute copy script to use 'textarea' instead of 'input' see attachment

    Joe
  • mbuitenkamp-4316mbuitenkamp-4316 Community Member Posts: 12
    perfect!

    thanks a million :)
Sign In or Register to comment.

So You Wanna Be An eLearning ROCKSTAR?

We're all fans of eLearning here! Want to become an eLearning ROCKSTAR? Just click on one of the buttons below to start your rocking journey!

Be The First On Your Block to Rock Lectora® 21!


Apply for exclusive early access to the latest version of Lectora® Desktop v21. Seating is limited so make sure you apply now!