Script to copy code

Please post all questions and comments regarding Help & Manual 7 here.

Moderators: Alexander Halser, Tim Green

Script to copy code

Unread postby John Johann » Tue Aug 13, 2019 8:54 pm

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?
John Johann
 
Posts: 158
Joined: Mon Aug 21, 2017 7:35 pm

Re: Script to copy code

Unread postby Tim Green » Wed Aug 14, 2019 7:16 am

Hi John,

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?

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. 8)
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.
User avatar
Tim Green
Site Admin
 
Posts: 20895
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany


Return to Help & Manual 7 Forum

Who is online

Users browsing this forum: No registered users and 7 guests