Copying text with formatting to clipboard and Autocopy.js
Friday, August 14, 2009 9:14:40 AM
I forgot to mention about it before 
Program for copying text with links and images to clipboard, from menu of Opera. Also included autocopy.js: htm2clip.zip (Installer).
Thread.
In Opera 10 you can use button Edit mode and simple copy/paste.
Or just button: Copy with formatting (drag'n'drop this button directly on panel).

Program for copying text with links and images to clipboard, from menu of Opera. Also included autocopy.js: htm2clip.zip (Installer).
Thread.
In Opera 10 you can use button Edit mode and simple copy/paste.
Or just button: Copy with formatting (drag'n'drop this button directly on panel).

1 2 Next »
Unregistered user # Thursday, February 28, 2008 3:01:30 AM
A.RuzanovLex1 # Thursday, February 28, 2008 10:54:47 AM
Jozkavs # Wednesday, August 13, 2008 2:15:22 PM
when pasting the content into a web page, it pasts again only a text and when pasting it into MS Word, it surprisingly pasts a word "undefined"...?
A.RuzanovLex1 # Friday, August 15, 2008 10:24:03 AM
Script autocopy.js is work. Item menu don't work, because it's page with frames.
Fixed.
A.RuzanovLex1 # Saturday, September 6, 2008 2:48:50 PM
oke # Monday, December 22, 2008 6:00:07 PM
This JS to "copy text with formatting" worked great until Opera version 9.62 but it stopped working after upgrading to 9.63
I am using Win XP Service Pack 3. All my JS settings as well as the configs for htm2clip still seems fine, and I have not done any other changes to my setup.
Do other people also have this problem or did something go wrong with my upgrade?
A.RuzanovLex1 # Monday, December 22, 2008 6:32:07 PM
oke # Tuesday, December 23, 2008 2:05:14 PM
Thanks for the workaround information on 9.63 It works fine.
scoobedoo # Tuesday, December 30, 2008 4:03:18 AM
I've installed your fix for html2clip on 9.63 and even after following the link above, I am unable to copy anything to the clipboard. I'm sure that the 'Copy text with formatting' link is calling html2clip.exe because if I rename the exe Opera complains about it. I have also made sure that all references to cache4 in about:config use DOS paths with ~1. So, I guess I'm stumped and ANY help would be appreciated! (I'm trying to get away from Firefox - I realized I was spending all my time trying to add features to it that Opera already had by default!)
This feature is the last thing I need for productivity (for MS OneNote usage) so any help would be great.
Is there anything else I can check or try?
Carlo
A.RuzanovLex1 # Wednesday, December 31, 2008 12:01:20 AM
Do you use content blocker?
scoobedoo # Tuesday, January 6, 2009 3:21:27 AM
Thanks for replying. Yes I do, but I have tried this on pages (like this one or google.com) where I haven't blocked any content. I also just tried disabling content blocking via the Site Preferences dialog and then trying it again. I see the same as before: I highlight a section, right click, press 'Copy text with formatting', the status bar pops up suggesting something is being loaded (status bar is hidden normally), and then I switch programs and nothing has been copied.
If it helps, I'm on Windows XP SP3 and Opera 9.63.
Other thoughts?
Carlo
A.RuzanovLex1 # Tuesday, January 6, 2009 9:00:35 AM
Rename Opera\program\htm2clip.exe. Copy ShowCmdLine.exe as Opera\program\htm2clip.exe.
Highlight a section, right click, press 'Copy text with formatting' and post here result.
Open (with notepad) a file from the command line and post content here.
scoobedoo # Tuesday, January 6, 2009 6:26:23 PM
Default(48) file output as copied from notepad. I tried copying part of my message to you above with the 'Edit' and Delete' links highlighted.
------------------------------------------------
SourceURL:http://my.opera.com/Lex1/blog/copying-text-with-formatting-to-clipboard-and-autocopy-js?cid=6732666
<HTML lang="en"><HEAD>
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
<LINK rel="EditURI" type="application/rsd+xml" title="RSD" href="/Lex1/xml/rsd">
<META name="viewport" content="width=device-width">
<LINK rel="stylesheet" href="/community/css/main.css" type="text/css" media="screen,projection,tv,print">
<STYLE type="text/css" media="screen,projection,tv,print">
#intro p.imgtext { display:none; }
</STYLE>
<LINK rel="stylesheet" href="/community/css/mobile.css" type="text/css" media="handheld">
<LINK rel="stylesheet" href="/community/css/themes/common-1.css" type="text/css" media="screen,projection,tv,print">
<LINK rel="stylesheet" href="/community/css/themes/default.css" type="text/css" media="screen,projection,tv,print">
<LINK rel="stylesheet" href="/community/css/themes/mobile02.css" type="text/css" media="handheld">
<LINK rel="shortcut icon" href="/community/favicon.ico" type="image/x-icon">
<LINK rel="meta" type="application/rdf+xml" title="FOAF" href="/Lex1/xml/foaf/">
<LINK rel="alternate" type="application/rss+xml" title="RSS 2.0 Feed" href="/Lex1/xml/rss/blog/">
<LINK rel="alternate" type="application/atom+xml" title="Atom 1.0 Feed" href="/Lex1/xml/atom/blog/">
<LINK rel="alternate" type="application/rss+xml" title="RSS 2.0 Feed for comments" href="/Lex1/xml/rss/comments/1019855">
<LINK rel="alternate" type="application/atom+xml" title="Atom 1.0 Feed for comments" href="/Lex1/xml/atom/comments/1019855">
<LINK rel="alternate" type="application/x-opera-widgets" href="http://widgets.opera.com/widgetize/Feed%20Reader/Advanced/?serve&skin=skin1&widgetname=My%20program%20for%20Opera&rel=myopera&ref=Lex1">
</HEAD><BODY id="myopera">
If it helps, I'm on Windows XP SP3 and Opera 9.63.
Other thoughts?
Carlo
[ EDIT | DELETE ]
scoobedoo # Tuesday, January 6, 2009 6:34:04 PM
A.RuzanovLex1 # Tuesday, January 6, 2009 8:21:28 PM
scoobedoo # Wednesday, January 7, 2009 4:20:16 PM
Mine is set to:
C:\Docume~1\scoob_e_doo\Locals~1\Applic~1\Opera\Opera\profile\cache4\temporary_download\
Which resolves perfectly fine in Explorer.
Can I ask what htm2clip.exe invokes to copy the 'default(xx)' files to the clipboard? I feel like that is my problem.
A.RuzanovLex1 # Friday, January 23, 2009 8:53:11 PM
Program ShowCmdLine.exe (renamed to the htm2clip.exe) shows this path?
Yes.
Unregistered user # Monday, February 2, 2009 10:59:37 AM
mesmol # Sunday, February 8, 2009 10:26:47 PM
unfortunately htm2clip don't work in 9.63
when i click on Copying text with formatting in contextmenu only phrase of "Copying text with formatting" copy to clipboard!!!!
plz help me
A.RuzanovLex1 # Monday, February 9, 2009 11:22:27 AM
Tommy27 # Thursday, February 12, 2009 8:46:41 AM
did u find a way to fix this issue?
Tommy27 # Thursday, February 12, 2009 8:54:36 AM
A.RuzanovLex1 # Thursday, February 12, 2009 7:09:19 PM
Tommy27 # Friday, February 13, 2009 1:46:22 PM
my question is: does html2clip work on Oepra 9.63 or is the new Opera release not comaptible with it?
whta should i do to make it work?
A.RuzanovLex1 # Friday, February 13, 2009 2:24:22 PM
Yes. After changing the path to temporary_download.
Tommy27 # Friday, February 13, 2009 3:11:51 PM
which path are you talking about?
do you have step by step instructions?
A.RuzanovLex1 # Friday, February 13, 2009 3:18:58 PM
Tommy27 # Saturday, February 14, 2009 2:21:04 PM
thank you very much for the nice html2clip program and the suggestions to make it work on Opera 9.63
Tommy27 # Sunday, February 15, 2009 11:02:51 AM
A.RuzanovLex1 # Sunday, February 15, 2009 11:58:37 AM
Tommy27 # Sunday, February 15, 2009 1:23:35 PM
i was able to move it on top and to keep a copy of it at the bottom too.
i had only to slightly rename the menu item name since u can't have 2 menu items with the same name.
here's the code:
[Hotclick Popup Menu]
Platform Windows, Item, "Copy text with formatting"="Go to Page, "javascript:(function(){var encodeBase64=function(a){var b='';var c=0;var i=0;var d='';var e=a.length;var f=[];var g='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';while(c=a.charCodeAt(i++)){if(c<0x80){f[f.length]=c}else if(c<0x800){f[f.length]=0xc0|(c>>6);f[f.length]=0x80|(c&0x3f)}else if(c<0x10000){f[f.length]=0xe0|(c>>12);f[f.length]=0x80|((c>>6)&0x3f);f[f.length]=0x80|(c&0x3f)}else{f[f.length]=0xf0|(c>>18);f[f.length]=0x80|((c>>12)&0x3f);f[f.length]=0x80|((c>>6)&0x3f);f[f.length]=0x80|(c&0x3f)}if(i==e){while(f.length%%3){f[f.length]=0;d+='='}}if(f.length>2){b+=g[f[0]>>2];b+=g[((f.shift()&3)<<4)|(f[0]>>4)];b+=g[((f.shift()&0xf)<<2)|(f[0]>>6)];b+=g[f.shift()&0x3f]}}return(b+d)};var selWin=function(w){if(w.getSelection()!='')return w;for(var i=0,f,r;f=w.frames;i++){try{if(r=arguments.callee(f))return r}catch(e){}}};var win=selWin(window);if(win){var doc=win.document;var link=win.location.href;if(win.location.protocol=='file:%27)link=link.replace(%27localhost%27,%27%27);var sel=doc.createDocumentFragment();var range=win.getSelection().getRangeAt(0);sel.appendChild(doc.createComment('StartFragment'));sel.appendChild(range.cloneContents());sel.appendChild(doc.createComment('EndFragment'));var ele=range.commonAncestorContainer;while(ele){if(ele.nodeType==1){var clone=ele.cloneNode(false);clone.appendChild(sel);sel=clone};ele=ele.parentNode};var head=doc.getElementsByTagName('head')[0];if(head){var h=sel.insertBefore(head.cloneNode(true),sel.firstChild);var b=h.getElementsByTagName('base')[0];if(!b){b=doc.createElement('base');h.insertBefore(b,h.firstChild)}if(!b.href)b.href=link;var m=h.getElementsByTagName('meta');for(var i=0,mi;mi=m;i++){if(mi.httpEquiv&&mi.httpEquiv.toLowerCase()=='content-type')mi.content='text/html; charset=utf-8'}};var scripts=sel.getElementsByTagName('script');for(var i=scripts.length-1;i>=0;i--){scripts.parentNode.removeChild(scripts)};var doctype='';var dt=doc.doctype;if(dt&&dt.name){doctype+='<!DOCTYPE '+dt.name;if(dt.publicId)doctype+=' PUBLIC \x22'+dt.publicId+'\x22';if(dt.systemId)doctype+=' \x22'+dt.systemId+'\x22';doctype+='>\n'};var f=doc.createElement('iframe');f.width=0;f.height=0;f.frameBorder='no';f.scrolling='no';f.src='data:text/cwf;charset=UTF-8;base64,%27+encodeBase64(%27SourceURL:%27+link+'\r\n\r\n'+doctype+sel.outerHTML);doc.documentElement.appendChild(f);f.parentNode.removeChild(f)}})();",,,"Copy""
--------------------1
Item, MI_IDM_DOCCOPY = Copy
Item, M_COPY_TO_NOTE = Copy to note
Platform Win2000-Unix-Mac-QNX, Feature Voice, Item, M_HOTCLICK_MENU_ITEM_SPEAK = Speak selection
--------------------2
Item, MI_IDM_SELSEARCH = Hotclick search, 200
Submenu, MI_IDM_SEARCH_DUMMY_PARENT, Internal Search With
Item, MI_IDM_SELDICTIONARY = Hotclick search, 50
Item, MI_IDM_SELENCYCLOPED = Hotclick search, 51
--------------------3
Submenu, MI_IDM_SELTRANSLATE_EN_FR_PARENT, Translate menu
Item, M_HOTCLICK_POPUP_MENU_GOTO_URL = Go to page, "%t"
Item, MI_IDM_SELMAIL = Send text in mail
--------------------4
Platform Windows, Item, "Copy text with formatting "="Go to Page, "javascript:(function(){var encodeBase64=function(a){var b='';var c=0;var i=0;var d='';var e=a.length;var f=[];var g='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';while(c=a.charCodeAt(i++)){if(c<0x80){f[f.length]=c}else if(c<0x800){f[f.length]=0xc0|(c>>6);f[f.length]=0x80|(c&0x3f)}else if(c<0x10000){f[f.length]=0xe0|(c>>12);f[f.length]=0x80|((c>>6)&0x3f);f[f.length]=0x80|(c&0x3f)}else{f[f.length]=0xf0|(c>>18);f[f.length]=0x80|((c>>12)&0x3f);f[f.length]=0x80|((c>>6)&0x3f);f[f.length]=0x80|(c&0x3f)}if(i==e){while(f.length%%3){f[f.length]=0;d+='='}}if(f.length>2){b+=g[f[0]>>2];b+=g[((f.shift()&3)<<4)|(f[0]>>4)];b+=g[((f.shift()&0xf)<<2)|(f[0]>>6)];b+=g[f.shift()&0x3f]}}return(b+d)};var selWin=function(w){if(w.getSelection()!='')return w;for(var i=0,f,r;f=w.frames;i++){try{if(r=arguments.callee(f))return r}catch(e){}}};var win=selWin(window);if(win){var doc=win.document;var link=win.location.href;if(win.location.protocol=='file:%27)link=link.replace(%27localhost%27,%27%27);var sel=doc.createDocumentFragment();var range=win.getSelection().getRangeAt(0);sel.appendChild(doc.createComment('StartFragment'));sel.appendChild(range.cloneContents());sel.appendChild(doc.createComment('EndFragment'));var ele=range.commonAncestorContainer;while(ele){if(ele.nodeType==1){var clone=ele.cloneNode(false);clone.appendChild(sel);sel=clone};ele=ele.parentNode};var head=doc.getElementsByTagName('head')[0];if(head){var h=sel.insertBefore(head.cloneNode(true),sel.firstChild);var b=h.getElementsByTagName('base')[0];if(!b){b=doc.createElement('base');h.insertBefore(b,h.firstChild)}if(!b.href)b.href=link;var m=h.getElementsByTagName('meta');for(var i=0,mi;mi=m;i++){if(mi.httpEquiv&&mi.httpEquiv.toLowerCase()=='content-type')mi.content='text/html; charset=utf-8'}};var scripts=sel.getElementsByTagName('script');for(var i=scripts.length-1;i>=0;i--){scripts.parentNode.removeChild(scripts)};var doctype='';var dt=doc.doctype;if(dt&&dt.name){doctype+='<!DOCTYPE '+dt.name;if(dt.publicId)doctype+=' PUBLIC \x22'+dt.publicId+'\x22';if(dt.systemId)doctype+=' \x22'+dt.systemId+'\x22';doctype+='>\n'};var f=doc.createElement('iframe');f.width=0;f.height=0;f.frameBorder='no';f.scrolling='no';f.src='data:text/cwf;charset=UTF-8;base64,%27+encodeBase64(%27SourceURL:%27+link+'\r\n\r\n'+doctype+sel.outerHTML);doc.documentElement.appendChild(f);f.parentNode.removeChild(f)}})();",,,"Copy""
Serdarteknomobil # Saturday, May 16, 2009 12:22:35 PM
Very good Opera 10 button
Serdarteknomobil # Friday, June 12, 2009 5:03:57 PM
Opera 10 beta not Rich Text Copy:cry:
Button does not work anymore
Please update fix button.
Thanks
Mağruf ÇolakoğluZAHEK # Wednesday, July 1, 2009 8:20:58 AM
Firstly ,thanks for this.It works in now Opera 10 v.1601 and copied contetnt should be paste to MS word , MS Office, Macromedia Dreamweaver, etc.as RTF with images.
Bu tas Teknomobil said above, it is not possible to copy in Opera Mail with images..Do you know its reason?
or it is possbile to do it?
A.RuzanovLex1 # Wednesday, July 1, 2009 11:49:09 AM
Maybe in future Opera Mail will be work with links...
A.RuzanovLex1 # Friday, July 3, 2009 11:51:28 AM
Better work with css. Now css-rules are copied , instead of links on *.css-files.
Tommy27 # Monday, July 27, 2009 8:22:58 PM
A.RuzanovLex1 # Wednesday, July 29, 2009 9:41:32 AM
Tommy27 # Tuesday, August 11, 2009 2:34:31 PM
do we still need this JS in Opera 10 or this feature will be present by defualt in the forthcoming Opera 10 final version?
P.S. i haven't tried yet Opera 10
A.RuzanovLex1 # Tuesday, August 11, 2009 9:46:49 PM
Tommy27 # Wednesday, August 12, 2009 7:25:30 AM
we are lucky you did that job
CEMcollents # Wednesday, September 9, 2009 1:46:11 PM
I read through the forum post and got utterly confused so I'm glad I just found this now. I just added the "Edit mode" button to my status bar (I use Opera Unite build 1691) and it works like a charm. I copied and pasted formatted text and images into Windows Live Writer, though it worked better pasting into Word - sometimes the formatting was lost in Live Writer (possible where it was formatted with CSS).
But it works well enough for me. Just one thing - when it copies links it copies relative links rather than absolute ones. Anything you can do about that? I understand why it does it, I just hope you know of a solution.
A.RuzanovLex1 # Wednesday, September 9, 2009 5:56:33 PM
htm2clip or something liked:
Go to page, "javascript:(function(){var links=document.getElementsByTagName('a');for(var i=0,link;link=links[i];i++){if(link.href)link.href=link.href};document.designMode=(document.designMode=='on')?'off':'on'})()",,"Edit mode","News Read"CEMcollents # Wednesday, September 9, 2009 9:32:41 PM
Originally posted by Lex1:
Sorry, I don't understand - do I need to run your installer and put this code somewhere, or can the button code be altered in any way?
A.RuzanovLex1 # Thursday, September 10, 2009 7:33:47 AM
Unregistered user # Sunday, September 27, 2009 6:37:23 AM
Tommy27 # Tuesday, October 6, 2009 3:02:50 PM
Unregistered user # Friday, February 19, 2010 1:12:55 PM
Tommy27 # Friday, February 19, 2010 2:55:01 PM
A.RuzanovLex1 # Friday, February 19, 2010 7:56:38 PM
Yes, autocopy.js is work.