My programs for Opera

Copying text with formatting to clipboard and Autocopy.js

,

I forgot to mention about it before smile
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).

AdBlock for Opera - analogue of «Adblock Plus: Element Hiding Helper»Thumbnails in opera cache

Comments

Anonymous Thursday, February 28, 2008 3:01:30 AM

Will Humes writes: Where do I install this js file in Opera?

A.RuzanovLex1 Thursday, February 28, 2008 10:54:47 AM

Jozkavs Wednesday, August 13, 2008 2:15:22 PM

the script does not work on some pages. I try to copy a list of tenders being published here: http://emits.esa.int/emits/owa/emits.main

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

Jozkavs

script does not work on some pages.


Script autocopy.js is work. Item menu don't work, because it's page with frames.

undefined


Fixed.

A.RuzanovLex1 Saturday, September 6, 2008 2:48:50 PM

Updated. Item menu «Copy text with formatting» now works and for pages with frames.

oke Monday, December 22, 2008 6:00:07 PM

Stopped working for 9.63

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?

oke Tuesday, December 23, 2008 2:05:14 PM

@Lex1

Thanks for the workaround information on 9.63 It works fine.

scoobedoo Tuesday, December 30, 2008 4:03:18 AM

@Lex1

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

scoobedoo
Do you use content blocker?

scoobedoo Tuesday, January 6, 2009 3:21:27 AM

Hey Lex1,

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

Other thoughts?


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

Oooh. Debugging tools. smile

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">
Copying text with formatting to clipboard and Autocopy.js - By A.Ruzanov
<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&amp;skin=skin1&amp;widgetname=My%20program%20for%20Opera&amp;rel=myopera&amp;ref=Lex1">
</HEAD><BODY id="myopera">
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

[ EDIT | DELETE ]

</BODY></HTML>

scoobedoo Tuesday, January 6, 2009 6:34:04 PM

Hmm. Looks like the output is well-formed...?

A.RuzanovLex1 Tuesday, January 6, 2009 8:21:28 PM

Yes, result is good. Imho, you have made any errors when applied workaround for 9.63.

scoobedoo Wednesday, January 7, 2009 4:20:16 PM

Does the link above point to the only workaround required (i.e. setting the Temporary_Download directory via opera:config to a full DOS-compatible path?

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

C:\Docume~1\scoob_e_doo\Locals~1\Applic~1\Opera\Opera\profile\cache4\temporary_download\


Program ShowCmdLine.exe (renamed to the htm2clip.exe) shows this path?

invokes to copy the 'default(xx)' files to the clipboard?

Yes.

Anonymous Monday, February 2, 2009 10:59:37 AM

Anonymous writes: Hi. I CANNOT get this to work in LINUX. Running the .exe using WINE does nothing. I copy the .js files to a Userjs directory and then in Opera settings point to that directory for the Javascript BUT I get no menu items?! Please help zcat

mesmol Sunday, February 8, 2009 10:26:47 PM

hi
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

Tommy27 Thursday, February 12, 2009 8:46:41 AM

i have experience the same troubles with Opera 9.63

did u find a way to fix this issue?

Tommy27 Thursday, February 12, 2009 8:54:36 AM

i mean, has the htm2clip.zip file been updated to fix the issue or are you still looking for a solution to solve it?

A.RuzanovLex1 Thursday, February 12, 2009 7:09:19 PM

htm2clip has no issue. If you use bugged browser, it's yours problem.

Tommy27 Friday, February 13, 2009 1:46:22 PM

i don't understand... it seems many users are experiencing troubles with Opera 9.63 and html2clip...

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

does html2clip work on Oepra 9.63


Yes. After changing the path to temporary_download.

Tommy27 Friday, February 13, 2009 3:11:51 PM

sorry i'm a little slow...
which path are you talking about?
do you have step by step instructions?

A.RuzanovLex1 Friday, February 13, 2009 3:18:58 PM

http://my.opera.com/Lex1/blog/show.dml/1175171?startidx=50#comment6618217

It's Opera bug. As workaround, set opera:config#UserPrefs|TemporaryDownloadDirectory as c:\internet\opera\temporary_download or similar _without_ spaces in the name.

oget fan writes:

You can also use the same Temporary Download Directory by changing:

C:\Documents and Settings\YourLoginName\Application Data\Opera\Opera\profile\cache4\temporary_downloads

to this:

C:\Docume~1\YourLoginName\Applic~1\Opera\Opera\profile\cache4\temporary_downloads

(No spaces in the folder names)

Tommy27 Saturday, February 14, 2009 2:21:04 PM

it works now.

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

just an additional information: is ther a way to have the "copy text with formatting" item at the top of the right click menu instead at the bottom of it?

A.RuzanovLex1 Sunday, February 15, 2009 11:58:37 AM

Yes. Edit menu. Also you can create hotkey.

Tommy27 Sunday, February 15, 2009 1:23:35 PM

thank u 4 the hint.

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

Thank you all
Very good Opera 10 button

Serdarteknomobil Friday, June 12, 2009 5:03:57 PM

Hi,
Opera 10 beta not Rich Text Copy:cry:
Button does not work anymore cry do not copy images:awww:
Please update fix button.
Thanks

z@h3kZAHEK Wednesday, July 1, 2009 8:20:58 AM

Hello Lex,

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

Imho, it's impossible, because after rtf-copying does not exists real images, only links.
Maybe in future Opera Mail will be work with links...

A.RuzanovLex1 Friday, July 3, 2009 11:51:28 AM

Updated.
Better work with css. Now css-rules are copied , instead of links on *.css-files.

Tommy27 Monday, July 27, 2009 8:22:58 PM

how do i upgrade to the new JS version on Opera 9.64?

A.RuzanovLex1 Wednesday, July 29, 2009 9:41:32 AM

Reinstall it with «Installer».

Tommy27 Tuesday, August 11, 2009 2:34:31 PM

thanks. just one more info.

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

Maybe. In current versions Opera 10 this function is not present.

Tommy27 Wednesday, August 12, 2009 7:25:30 AM

Ok. I wonder why Opera still does not have this important function...

we are lucky you did that job

CEMcollents Wednesday, September 9, 2009 1:46:11 PM

Excellent stuff! cheers

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

solution


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:

htm2clip or something liked:



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

Use any button generator and «write the action as plain text».

Anonymous Sunday, September 27, 2009 6:37:23 AM

Compuland writes: Hi. Just wanna say thanks, i was about to skip using Opera just because of the copy/paste thingy. But now it works with that work around.

Tommy27 Tuesday, October 6, 2009 3:02:50 PM

please clarify what happened with Opera 10: is the autocopy.js still working or is now obsolete?

Anonymous Friday, February 19, 2010 1:12:55 PM

Alexandrer writes: Кнопка получается без иконки! (opera 10) Я отредактировал standard_toolbar.ini вот так: Button9, "Копировать с форматированием"=Go to page, "javascript:void(document.designMode='on')",,, "Window Hotlist Icon" & Delay, 300,,, "Window Hotlist Icon" & Copy,,,, "Window Hotlist Icon" & Delay, 300,,, "Window Hotlist Icon" & Go to page, "javascript:void(document.designMode='off')",, "Копировать с форматированием", "Window Hotlist Icon" now ok.

Tommy27 Friday, February 19, 2010 2:55:01 PM

sorry, I can't read russian...

A.RuzanovLex1 Friday, February 19, 2010 7:56:38 PM

Tommy27
Yes, autocopy.js is work.

How to use Quote function:

  1. Select some text
  2. Click on the Quote link

Write a comment

Comment
(BBcode and HTML is turned off for anonymous user comments.)

If you can't read the words, press the small reload icon.


Smilies