> Script works well.
>
> Couple of things, maybe this has nothing to do with the script.
>
> Just name and address, I don't get the company name or department. Also,
> some people get a prefix or suffix, such as "Dr." or "Esq." but that never
> shows up on the envelope address. Am I missing something?
>
> Also, & this must be a Word problem, not the script, is there some way to
> change the default font used when addressing envelopes, or must I do this
> manually each time?
>
> TIA,
>
> Jonathan
>
Below is a modified version of George’s Script that will allow you to:
- Set Font and Size for Address and Return Address
- Set the Envelope Size to use
- Includes the Company name if it is a Work Address
- Includes the prefix and suffix of a contact if they exist
Simply modify the properties at the top of the script.
--original script by George Clark
--modifications by Omar Shahine
--set your font and size for address and return address
property AddrFontName : "Verdana"
property AddrFontSize : "14"
property RetAddrFontName : "Verdana"
property RetAddrFontSize : "12"
--set the envelope size
property EnvelopeSize : "Size 10"
property printHome : false
tell application "Microsoft Entourage"
try
set cnt to selection
if cnt is "" or cnt is {} then
beep
return
end if
on error
beep
return
end try
set cnt to item 1 of cnt
if class of cnt is not contact then
display dialog ¬
"Please select a contact in your address book" buttons "Okay" default button "Okay"
return
end if
set l to (button returned of (display dialog ¬
"Use Home or Work address?" buttons {"Home", "Work", "Cancel"} ¬
default button "Home"))
if l is "Cancel" then
return
else if l is "Home" then
set a to home address of cnt
set printHome to true
else
set a to business address of cnt
end if
set n to first name of cnt & " " & last name of cnt
set com to the company of cnt
set t to the title of cnt
set suf to the suffix of cnt
set s1 to street address of a
set s2 to street address 2 of a
set c to city of a
set s to state of a
set z to zip of a
end tell
if (s1 is "" and s2 is "") or (c is "") or (s is "") or (z is "") then
display dialog "This contact does not have a valid " & l & ¬
" address" buttons {"Okay"} default button "Okay"
return
end if
set b to (button returned of (display dialog ¬
"Do you want to print a barcode?" buttons {"Yes", "No"} default button "No"))
set csz to c & ", " & s & " " & z
if t is not "" then
set n to t & " " & n
end if
if suf is not "" then
set n to n & " " & suf
end if
set m to "recep = " & AddQuotes(n) & " & vbCr & "
if not printHome then
if com is not "" then
set m to m & AddQuotes(com) & " & vbCr & "
end if
end if
if s1 is not "" then
set m to m & AddQuotes(s1) & " & vbCr & "
end if
if s2 is not "" then
set m to m & AddQuotes(s2) & " & vbCr & "
end if
set m to m & AddQuotes(csz) & return
set m to m & "retaddr = Application.UserName & vbCr & Application.UserAddress"
set m to m & return & "ActiveDocument.Envelope.Insert Address:=recep, ReturnAddress:=retaddr, Size:= " & AddQuotes(EnvelopeSize)
set m to m & return & "With ActiveDocument.Envelope.AddressStyle.Font"
set m to m & return & ".Bold = False"
set m to m & return & ".Name = " & AddQuotes(AddrFontName)
set m to m & return & ".Size = " & AddQuotes(AddrFontSize)
set m to m & return & "End With"
set m to m & return & "With ActiveDocument.Envelope.ReturnAddressStyle.Font"
set m to m & return & ".Bold = False"
set m to m & return & ".Name = " & AddQuotes(RetAddrFontName)
set m to m & return & ".Size = " & AddQuotes(RetAddrFontSize)
set m to m & return & "End With"
set m to m & return & "ActiveDocument.Envelope.PrintOut"
if b is "Yes" then
set m to m & ", PrintBarCode:=True"
end if
tell application "Microsoft Word"
activate
try
get document 1
on error
make new document
end try
do Visual Basic m
end tell
on AddQuotes(theString)
set theString to "\"" & theString & "\""
return theString
end AddQuotes
--
Omar Shahine - [EMAIL PROTECTED] - http://www.shahine.com/omar
Program Manager - Entourage:mac - Macintosh Business Unit
