10 October 2006

Address Book Plug-In: Show Emails from or to

One of the recurring topics int he old blog were short AppleScripts to optimize the workflow. Here is a new one.

Show Emails From

Click on the link above and save the script that is opened in Script Editor in ~/Library/Address Book Plug-Ins/ as Show Email From. Create the folder if necessary. Then (re-)start Address Book and click and hold on the label next to an email address. You can now select the Show Emails from option, which will open a new message browser window in Mail and fill out the search field to show emails from this email address only.

Then go back in to Script Editor and change the lines
   return "Show emails from " & theName

to
   return "Show emails to " & theName

and
   click button "From" of window 1 

to
   click button "To" of window 1 

or click here for the entire script and save this as Show Email To in the same folder. Restart Address Book.

BTW: Opening new Mail viewer windows (File Menu > New Viewer Window) is one of the 'unsung' features in Mail which really increases my productivity. If you aren't using that yet, then start remembering the keyboard shortcut (command-option-N) to your repertoire.

18 comments:

Anonymous said...

Note, in order for this to work, UI scripting must be activated:
http://www.apple.com/applescript/uiscripting/01.html

Anonymous said...

What is the advantage of this over using the same built-in functionatilty in Mail's search ?

Anonymous said...

Doesn't work for me. Instead, I get multiple Mail windows opening with "No Mailbox Selected" in the window title area. The number of opened Mail windows is equal to the number of Email accounts defined in my Mail app.

I've got the UI scripting enabled.

Something funny is going on here, possibly a bug in either Applescript or Mail, as when I manually perform the same actions that the script is doing, it works, and populates the single open Mail window with the search results.

OS X PPC 10.4.8, with Xcode 2.3 installed.

I may fool around with this and try to fix it, but it seems easier at this point to copy & paste the address from the Address Book into the Mail search field and do this manually.

Anonymous said...

I have the same problem as above.

Armin said...

My bad. You have to enable access for assistive devices in the Universal Access pane. I have had this setting turned on for so long that I always forget to check for it or to even mention it.

This script actually uses Mail's built-in search, and is not meant to replace this, but just to short cut a procedure that I had been doing quite often.

To the anonymous poster above who experienced problems, I would guess that this script has problems if run under non-english localisations. I might be able to fix that.

Home Cookin' said...

Thanks for a handy little script that works perfectly. Being able to launch this directly from AddressBook instead of opening Mail, then performing a search, is much snappier.

Pascal said...

Armin>
Very good idea ! Thanks.
Unfortunately, i confirm that your script has problems if run under non-english localisations (french), but i don't know how to fix it. I don't know anything in Applescript.

When i clic on email address in Addressbook, it open a new window in Mail. That's all.
Can you fix it ?

Anonymous said...

Sweet. Works exactly as advertised and it is a very nice way to get an instant result while in the AB. Thanks!

Harry von Hamhorse said...

Ditto .. SWEET!! ... will use this time-saver every day! Thanks.

Anonymous said...

Wish I could make this work for me. I get one mail window with the title "No Mailbox Selected." The script doesn't seem to be able to find the Search Box. I don't know much about Applescript, but I can make the script tell me that toolbar 1 of window 1 exists, but not that first text field of that toolbar exists.

Anonymous said...

Indeed, the scripts didn't work in a foreign localisation. After replacing "All Mailboxes" and "From" by your local equivalents they work well.

Unknown said...

Thanks! Nice work.

Anonymous said...

Works, but both scripts show emails from AND to the person.

Anonymous said...

Does work but includes all emails "to" and "from" regardless of script used. Also, to get the script to work for me, the search box has to be the last item in Mail's header.

Unknown said...

This works just fine. I followed the instructions and have no problems. It is a very useful tool for me. I am managing a client list for my flute repair shop and one click takes me to all the emails to or from a client. Sure you can copy and paste, switch back and forth from address book to mail, but if there is a useful script or shortcut, why not use it!

Alex said...

I often work with address book in my OE. Yesterday I opened it and added some new contacts. But today I couldn't find anything of all my data in it. For luck I found in the Internet this software - outlook express repair address. I was very surprised when the tool solved my problem for a minute and I didn't spend the money. It was great and quite rapid.

Anonymous said...

Works fine in German localization, thanks for a great solution.

Would there be a way to modify the scripts to obtain "sent to" and "received from" results separately? As it stands, both do the same. It would be great to have a hint as to which terms need to be localized.

Cheers!

Anonymous said...

I am running Lion and am not getting this to work even though a followed all instructions,,,,bugs me...The menu item is not showing up in Addressbook

Any suggestions?