Script to copy code
Moderators: Alexander Halser, Tim Green
-
- Posts: 305
- Joined: Mon Aug 21, 2017 7:35 pm
Script to copy code
I've probably missed it when searching, but is there a script somehwere to copy a block of code from a published CHM into the clipboard?
- Tim Green
- Site Admin
- Posts: 23181
- Joined: Mon Jun 24, 2002 9:11 am
- Location: Bruehl, Germany
- Contact:
Re: Script to copy code
Hi John,
The JavaScript document.execCommand("copy") command will copy the currently selected text to the clipboard. However, for security reasons it only works in edit mode (i.e. within editable fields and text editing boxes), so you would need to display the code in an editable box to be able to select it. It's really much easier to put your code example in a table cell and let the user select it and copy it with right-click.I've probably missed it when searching, but is there a script somehwere to copy a block of code from a published CHM into the clipboard?
Regards,
Tim (EC Software Documentation & User Support)
Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
Tim (EC Software Documentation & User Support)
Private support:
Please do not email or PM me with private support requests -- post to the forum directly.