Skip navigation

Lost password? | Help

My program 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).

Thumbnails in opera cacheToolbar and menu with BBCode Ver 1.4.24 Eng

Comments

Anonymous 28. February 2008, 03:01

Will Humes writes:

Where do I install this js file in Opera?

Jozkavs 13. August 2008, 14:15

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.Ruzanov 15. August 2008, 10:24

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.Ruzanov 6. September 2008, 14:48

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

Jimmy 22. December 2008, 18:00

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?

Jimmy 23. December 2008, 14:05

@Lex1

Thanks for the workaround information on 9.63 It works fine.

scoobedoo 30. December 2008, 04:03

@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.Ruzanov 31. December 2008, 00:01

scoobedoo
Do you use content blocker?

scoobedoo 6. January 2009, 03:21

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.Ruzanov 6. January 2009, 09:00

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 6. January 2009, 18:26

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&skin=skin1&widgetname=My%20program%20for%20Opera&rel=myopera&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 6. January 2009, 18:34

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

A.Ruzanov 6. January 2009, 20:21

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

scoobedoo 7. January 2009, 16:20

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.Ruzanov 23. January 2009, 20:53

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 2. February 2009, 10:59

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 8. February 2009, 22:26

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 12. February 2009, 08:46

i have experience the same troubles with Opera 9.63

did u find a way to fix this issue?

Tommy27 12. February 2009, 08:54

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.Ruzanov 12. February 2009, 19:09

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

Tommy27 13. February 2009, 13:46

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.Ruzanov 13. February 2009, 14:24

does html2clip work on Oepra 9.63


Yes. After changing the path to temporary_download.

Tommy27 13. February 2009, 15:11

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

A.Ruzanov 13. February 2009, 15:18

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 14. February 2009, 14:21

it works now.

thank you very much for the nice html2clip program and the suggestions to make it work on Opera 9.63

Tommy27 15. February 2009, 11:02

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.Ruzanov 15. February 2009, 11:58

Yes. Edit menu. Also you can create hotkey.

Tommy27 15. February 2009, 13:23

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:')link=link.replace('localhost','');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,'+encodeBase64('SourceURL:'+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:')link=link.replace('localhost','');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,'+encodeBase64('SourceURL:'+link+'\r\n\r\n'+doctype+sel.outerHTML);doc.documentElement.appendChild(f);f.parentNode.removeChild(f)}})();",,,"Copy""

Serdar 16. May 2009, 12:22

Thank you all
Very good Opera 10 button

Serdar 12. June 2009, 17:03

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@h3k 1. July 2009, 08:20

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.Ruzanov 1. July 2009, 11:49

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.Ruzanov 3. July 2009, 11:51

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

Tommy27 27. July 2009, 20:22

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

A.Ruzanov 29. July 2009, 09:41

Reinstall it with «Installer».

Tommy27 11. August 2009, 14:34

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.Ruzanov 11. August 2009, 21:46

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

Tommy27 12. August 2009, 07:25

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

we are lucky you did that job

CEM 9. September 2009, 13:46

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.Ruzanov 9. September 2009, 17:56

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"

CEM 9. September 2009, 21:32

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.Ruzanov 10. September 2009, 07:33

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

Anonymous 27. September 2009, 06:37

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 6. October 2009, 15:02

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

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