• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Printing An Envelope from Contacts
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Printing An Envelope from Contacts


  • Subject: Printing An Envelope from Contacts
  • From: Gil Dawson <email@hidden>
  • Date: Tue, 12 Jan 2016 13:52:00 -0800

Hi--

Last November I upgraded my MacBook Pro from Snow Leopard (10.6.8) to El Capitan (10.11.2).  As one might expect after five major system upgrades, quite a few things stopped working.  I'm gradually finding fixes.

One of the things that quit was this marvelous script I used to print envelopes from Address Book.  I'm not sure where I got it; I thought it was this forum, but now I can't find it here.  

I put this script in ~/Library/Address Book Plug-Ins/Print Envelope.scpt and it added "Print Envelope" to the drop-down list of commands next to an address.  In MacOS 10.11.2, the script is still in that location, but the new analog to Address Book, named Contacts, isn't affected.

I looked; in 10.11.2 there is no folder named ~/Library/Contacts Plug-Ins.  Perhaps there is another folder that this script could be dropped into, so that it would work with Contacts?

The AppleScript Editor on my other machine running 10.6.8 shows the original source for this script:

property myPath : ""


using terms from application "Address Book"


on action property
return "address"
end action property


on action title for p with v
return "Print envelope"
end action title


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


on perform action for p with v
try
set myPath to (path to me as string)
set {Line1, Line2, Line3, Line4} to {"", "", "", ""}
if name of p is not missing value then set Line1 to ¬
name of p
if street of v is not missing value then set Line2 to ¬
street of v
if city of v is not missing value then set Line3 to ¬
city of v
if state of v is not missing value then set Line3 to ¬
Line3 & ", " & state of v
if zip of v is not missing value then set Line3 to ¬
Line3 & "   " & zip of v & " "
tell application "Microsoft Word"
activate
set NewDoc to create new document
print out envelope ¬
envelope object of NewDoc ¬
address Line1 & return & Line2 & return & Line3
close NewDoc saving no
end tell
on error errm number errn
display dialog "Error in " & myPath & ": " & return & ¬
errm & " #" & errn & "."
end try
end perform action


end using terms from

On my MacBook Pro running 10.11.2, the AppleScript Editor renders the same script file slightly differently:

property myPath : ""


using terms from application "Contacts"


on action property
return "address"
end action property


on action title for p with v
return "Print envelope"
end action title


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


on perform action for p with v
try
set myPath to (path to me as string)
set {Line1, Line2, Line3, Line4} to {"", "", "", ""}
if name of p is not missing value then set Line1 to ¬
name of p
if street of v is not missing value then set Line2 to ¬
street of v
if city of v is not missing value then set Line3 to ¬
city of v
if state of v is not missing value then set Line3 to ¬
Line3 & ", " & state of v
if zip of v is not missing value then set Line3 to ¬
Line3 & "   " & zip of v & " "
tell application "Microsoft Word"
activate
set NewDoc to create new document
print out envelope ¬
envelope object of NewDoc ¬
address Line1 & return & Line2 & return & Line3
close NewDoc saving no
end tell
on error errm number errn
display dialog "Error in " & myPath & ": " & return & ¬
errm & " #" & errn & "."
end try
end perform action


end using terms from

I'd appreciate suggestions to get this working again.  It's really useful to me.

--Gil
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Printing An Envelope from Contacts
      • From: Christian Boyce <email@hidden>
  • Prev by Date: Re: Scripting NoteBook
  • Next by Date: Re: How to Run a "sudo" Terminal Command
  • Previous by thread: Re: Script Editor > Library window
  • Next by thread: Re: Printing An Envelope from Contacts
  • Index(es):
    • Date
    • Thread