Create a Copy button to copy text in a text box on slide

Hi,

Is there any provision to copy the content in text box in a clip board which user may paste in other software such as Notepad, Word etc.

This feature will help taking notes for users.

Please advice.

Thanks!

Hi,

After inputting text into a Text box, you can select all text (or a part) by dragging the mouse cursor or using hotkey (Ctrl+A) to select text and perform copy action as normal. You can paste the copied text to any software as you want.

Regards,

Thanks Thanhlvt, but what I want is a button should copy the text in to a clipboard. manual selection is what boss doesn’t want. He wants it to happen on a single click.

Hi Shripad,

You can add Execute JavaScript action to On Click event of a button without the following code:

// copy text from sourceObject to clipboard
var sourceObject = prez.object('source object name'); // update object name here

if (navigator.clipboard && navigator.clipboard.writeText) {
  navigator.clipboard.writeText(sourceObject.text()).then(function() {
    // succeed
  }, function() {
    // fail
  });
} else {
  var sourceTextNode = sourceObject.textNode;
  if (sourceTextNode.select) {
    sourceTextNode.select();
  } else {
    var range = document.createRange();
    range.selectNode(sourceTextNode);
    window.getSelection().addRange(range);
  }
  document.execCommand('copy');
}

Regards

Thanks Toanls,

I will check and confirm soon.

Hi,

I tried this method but no much success. Have put a sql script in a text caption (Text Caption_16)

On clicking the button, it did copy but only component name (Text Caption_16). Since the sql script is having many semi colons, quotes, slashes, I cannot really paste the entire text instead of source name object in quotes.

Since I’m not from programming background, I’m really struggling with this. Please help.

Thanks,
Shri

Hi,

Please send your project to support@atomisystems.com so that I can check.

Regards

Sent mail. Kindly check. Thanks!

Hi,

Your project works well on my test.
When I click “Tablespace Creation Sample Script” button, the text in “T1” text caption (CREATE TABLESPACE…) is copied to the clipboard.

Which browser did you try it on? Can you please check it again?

Regards

Ohh yes… I was trying it in MS Edge but when I tried in Chrome it worked well.

Any changes required in script to work it in Edge? or isn’t the script compatible for Edge?

Please let me know. And special thanks for checking the project.

Hi,

Maybe T1 text caption is hidden, so its text can’t be copied on IE/Edge.
You can clear T1 “Initially Hidden” property to make it works.

Regards

Thanks!

I moved the text outside boundaries of the slide with Initially hidden unchecked. The code runs quite good.