Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Applications > Somebody: write this plug-in for Address Book?

Somebody: write this plug-in for Address Book?
Thread Tools
cpac
Professional Poster
Join Date: Jul 2001
Location: New York, NY
Status: Offline
Reply With Quote
Apr 13, 2004, 08:04 PM
 
Can somebody write an Address Book plugin to automatically address letters & envelopes?

(like the reverse-telephone directory plugin released today on versiontracker)

It'd just take the Name and address of the "me" card and of the selected card and create a letter or envelope in TextEdit, based on template stored in app support or documents or something.

I've tried doing this with applescript, but I've run into a snag in that Applescript has no font control, at least in TextEdit.

Anyway, I think it'd be very useful and popular...

PS - If those with more know-how tell me this is something a newbie could learn to do with a few free weeks, I'll try it after the bar exam this summer...
cpac
     
chabig
Addicted to MacNN
Join Date: Jun 1999
Location: Las Vegas, NV, USA
Status: Offline
Reply With Quote
Apr 13, 2004, 08:46 PM
 
It's already been done...iDress.

Chris
     
cpac  (op)
Professional Poster
Join Date: Jul 2001
Location: New York, NY
Status: Offline
Reply With Quote
Apr 13, 2004, 11:39 PM
 
not really what I had in mind - iDress is it's own app, and it's overkill (especially since in 10.3 we can print nice labels from the address book directly)

What I was looking for was more along the lines of an Address Book plugin (not a separate app) so that I'm looking at a contact in address book, I click on the address and in the menu where it currently gives me options to "Map of" "Copy mailing label" or "Copy URL of Map" there'd be another option to "compose letter in TextEdit"

Selecting that option would then create a new TextEdit document based on a template you can modify (perhaps just another TextEdit document, stored someplace in the Library, with specifically coded Tags for where the info should be inserted), addressed to that person at that particular address.

Does that make sense?
cpac
     
Diggory Laycock
Professional Poster
Join Date: Oct 2001
Location: London
Status: Offline
Reply With Quote
Apr 14, 2004, 06:10 AM
 
Here's something to get you started - I've basically just splatted two different scripts off the web together:

I still don't really understand TextEdit's Scripting - - it seems very unreliable and rigid - but the script seems to work:

-- Put this script into your "Address Book Plugins" folder in your ~/Library folder.
[php]
using terms from application "Address Book"

on action property
return "address"
end action property



on action title for p with e
set theName to (first name of p) & " " & (last name of p)
return "Address letter to " & theName & " (2)"
end action title



on should enable action for p with e
return true
end should enable action



on perform action for p with e
set theAddress to (first name of p) & " " & (last name of p) & return & (street of e) & return & (city of e) & space & (state of e) & space & (zip of e)

set myAddr to address 1 of my card

set returnAddress to (first name of my card) & " " & (last name of my card) & return & (street of myAddr) & return & (city of myAddr) & space & (state of myAddr) & space & (zip of myAddr)
makeEnvelope(returnAddress, theAddress)
end perform action
end using terms from



on makeEnvelope(fromAddress, toAddress)

tell application "TextEdit"
activate
make new document at the beginning of documents

tell front window
set name to "Letter to blah"
end tell

set the text of the front document to (toAddress)

tell the text of the front document
set font to "Baskerville"
set size to 36
end tell
end tell
end makeEnvelope
[/php]
     
Krypton
Mac Elite
Join Date: May 2001
Location: Cambridge UK
Status: Offline
Reply With Quote
Apr 14, 2004, 07:21 AM
 
If you have Stone Create, the developer provides a script to do exactly what you're after.
     
Diggory Laycock
Professional Poster
Join Date: Oct 2001
Location: London
Status: Offline
Reply With Quote
Apr 14, 2004, 08:10 AM
 
Originally posted by Krypton:
If you have Stone Create, the developer provides a script to do exactly what you're after.
Yes, that's one of the scripts I ruthlessly slaughtered to make the above script.
     
cpac  (op)
Professional Poster
Join Date: Jul 2001
Location: New York, NY
Status: Offline
Reply With Quote
Apr 14, 2004, 09:52 AM
 
Hey thanks Diggory!

Now I've just got to play around with it.

[edit: figured out my initial problems]
( Last edited by cpac; Apr 14, 2004 at 10:24 AM. )
cpac
     
cpac  (op)
Professional Poster
Join Date: Jul 2001
Location: New York, NY
Status: Offline
Reply With Quote
Apr 14, 2004, 02:21 PM
 
Ok - I've made quite a bit of progress, but have a couple scripty questions for y'all out there:

(1) Is there any way to tell text to take a particular alignment (i.e. center align?)

(2) In the above example script there's code that sets the name of the front window to something specified (I've tinkered with it so that now it sets the name to something useful like "2004-4-15 Ltr to John Smith" but when I go in TextEdit to "Save" it defaults to "Untitled 10" or whatever. Can I force the window title to be the default save-as title?

TIA!
cpac
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 12:45 PM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,