how to copy sender's name and address to clipboard

User Help for Mozilla Thunderbird
Locked
Leopoldus
Posts: 353
Joined: April 8th, 2008, 4:29 am

how to copy sender's name and address to clipboard

Post by Leopoldus »

In TB 2.0.16 with installed add-on Mnenhy I can not copy the whole line of data from the field FROM to clipboard. Shortcut Ctr+C does not work at all, instead one can previously select text in a header's field and then use "copy selection" command from context menu.
But it is not possible to select any text in the field FROM.
Well, there is a command "Copy Email Address" in the context menu for FROM field, but I need to copy the both address and the sender's name.
As I need this feature many times per hour, this is a real problem for me. Could somebody offer any workaround? May be some key via KeyConfig?

Thanks in advance!
User avatar
DanRaisch
Moderator
Posts: 127188
Joined: September 23rd, 2004, 8:57 pm
Location: Somewhere on the right coast

Re: how to copy sender's name and address to clipboard

Post by DanRaisch »

You could use Ctrl+U and copy the From: entry from the message source screen.
Leopoldus
Posts: 353
Joined: April 8th, 2008, 4:29 am

Re: how to copy sender's name and address to clipboard

Post by Leopoldus »

You could use Ctrl+U and copy the From: entry from the message source screen.

Thanks, but is takes huge time to find the proper line in the source code window. I've tried it in practice and can confirm, that re-entering the whole line manually takes almost the same time :(
dorando
Posts: 1203
Joined: January 9th, 2004, 9:57 am
Contact:

Re: how to copy sender's name and address to clipboard

Post by dorando »

Leopoldus wrote:May be some key via KeyConfig?
Add a new key with

Code: Select all

var hdr = messenger.msgHdrFromURI(GetSelectedMessages()[0]);
Components.classes["@mozilla.org/widget/clipboardhelper;1"]
.
getService(Components.interfaces.nsIClipboardHelper).copyString(hdr.author); 
User avatar
cyberpitboss
Posts: 8
Joined: May 2nd, 2006, 10:49 am

Re: how to copy sender's name and address to clipboard

Post by cyberpitboss »

The easiest way that I have found to do what you want is to use choose "compose mail to" from the context menu and then from the new message window you can quickly copy the whole thing. It only takes a second or two extra but it works very well.
Leopoldus
Posts: 353
Joined: April 8th, 2008, 4:29 am

Re: how to copy sender's name and address to clipboard

Post by Leopoldus »

dorando wrote:
Leopoldus wrote:May be some key via KeyConfig?
Add a new key with

Code: Select all

var hdr = messenger.msgHdrFromURI(GetSelectedMessages()[0]);
Components.classes["@mozilla.org/widget/clipboardhelper;1"]
.
getService(Components.interfaces.nsIClipboardHelper).copyString(hdr.author);  


Thank you, it works!
However there is one issue here too: this key copies the sender's name source code, not how it is displayed in the message window. That means, if a sender's name includes some non-English encoding characters (as German umlaut letters Ä, Ü etc.), say Heinrich Böll, the source code for the sender's Heinrich Böll is copied as =?ISO-8859-1?Q?Heinrich_B=F6ll?= <Heinrich.boll@hot.de> or if in the message uses Unicode the name will be copied even as Heinrich =?UTF-8?B?QsO2bGwgLSBVVEYtOA==?= <Heinrich.boll@hot.de>.

It would be fine to get some way to copy the sender's name to clipboard just in the form as it is shown in the field "FROM" in a message window and preview pane.
dorando
Posts: 1203
Joined: January 9th, 2004, 9:57 am
Contact:

Re: how to copy sender's name and address to clipboard

Post by dorando »

Try

Code: Select all

var fullAddress = document.getElementById("expandedfromBox").mAddresses[0].fullAddress;
Components.classes["@mozilla.org/widget/clipboardhelper;1"]
.
getService(Components.interfaces.nsIClipboardHelper).copyString(fullAddress); 
Leopoldus
Posts: 353
Joined: April 8th, 2008, 4:29 am

Re: how to copy sender's name and address to clipboard

Post by Leopoldus »

dorando wrote:Try

Code: Select all

var fullAddress = document.getElementById("expandedfromBox").mAddresses[0].fullAddress;
Components.classes["@mozilla.org/widget/clipboardhelper;1"]
.
getService(Components.interfaces.nsIClipboardHelper).copyString(fullAddress); 


Seems it does not work at all (does not copy anything) :(
Does it work at your machine?
klades
Posts: 855
Joined: May 3rd, 2004, 1:20 pm
Contact:

Re: how to copy sender's name and address to clipboard

Post by klades »

dorando wrote:
Leopoldus wrote:May be some key via KeyConfig?
Add a new key with

Code: Select all

var hdr messenger.msgHdrFromURI(GetSelectedMessages()[0]);
Components.classes["@mozilla.org/widget/clipboardhelper;1"]
.
getService(Components.interfaces.nsIClipboardHelper).copyString(hdr.author);  


Use hdr.mime2DecodedAuthor instead hdr.author
Leopoldus
Posts: 353
Joined: April 8th, 2008, 4:29 am

Re: how to copy sender's name and address to clipboard

Post by Leopoldus »

klades wrote:Use hdr.mime2DecodedAuthor instead hdr.author

This really works! Now I have and can use the both options as I needed. Thank you!
Leopoldus
Posts: 353
Joined: April 8th, 2008, 4:29 am

Re: how to copy sender's name and address to clipboard

Post by Leopoldus »

To continue the same subject, what should one to write in the code for KeyConfig key in order to copy the addressee and his/her address? I guess that the difference is in the line copyString(hdr.author);, but what is the correct name of the string for addressee?
Thanks!
dorando
Posts: 1203
Joined: January 9th, 2004, 9:57 am
Contact:

Re: how to copy sender's name and address to clipboard

Post by dorando »

Try

Code: Select all

hdr.mime2DecodedRecipients
User avatar
LIMPET235
Moderator
Posts: 39937
Joined: October 19th, 2007, 1:53 am
Location: The South Coast of N.S.W. Oz.

Re: how to copy sender's name and address to clipboard

Post by LIMPET235 »

Rakka7,
I split your post off to here...
> http://forums.mozillazine.org/viewtopic ... &t=3037008
as this old thread needs it's rest.

Locking.
[Ancient Amateur Astronomer.]
Win-10-H/64 bit/500G SSD/16 Gig Ram/450Watt PSU/350WattUPS/Firefox-115.0.2/T-bird-115.3.2./SnagIt-v10.0.1/MWP-7.12.125.

(Always choose the "Custom" Install.)
Locked