Skip navigation

Sign up | 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.

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?

Lex1 28. February 2008, 10:54

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"...?

Lex1 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.

Lex1 6. September 2008, 14:48

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

oke 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?

oke 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

Lex1 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

Lex1 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...?

Lex1 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.

Lex1 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?

Lex1 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?

Lex1 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?

Lex1 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?

Lex1 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""

teknomobil 16. May 2009, 12:22

Thank you all
Very good Opera 10 button

teknomobil 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

ZAHEK 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?

Lex1 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...

Lex1 3. July 2009, 11:51

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

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

Type the two words displayed in the image below:


Smilies