I have a VBScript routine to print envelopes by automating Word. This works just fine.
Now I'm trying to do the same thing with AppleScript, also using the Word application. Here is what I have so far:
set recipientAddress to text returned of (display dialog "Enter the recipient's address:" default answer "")
-- Prompt for recipient city, state, and zip
set recipientCityStateZip to text returned of (display dialog "Enter the recipient's city, state, and zip:" default answer "")
-- Combine all address parts into a full address
set fullAddress to recipientName & return & recipientAddress & return & recipientCityStateZip
-- Create a new Word document and print the envelope
set dialogResult to display dialog "To print envelope for:" & return & return & recipientName & return & recipientAddress & return & recipientCityStateZip & return & return & "Center envelope upside-down in printer with flap on left" & return & return & "Continue?" buttons {"Yes", "No"} default button 2 with icon caution
if button returned of dialogResult is "Yes" then
tell application "Microsoft Word"
set wdDoc to make new document
-- Print the envelope with the collected recipient address and hard-coded return address
-- wdDoc's print out envelope(address:fullAddress, returnAddress:returnAddress)
-- Close the document without saving
close wdDoc saving no
end tell
end if
What does NOT work is the commented line near the end of the script which starts with -- wdDoc's print out envelope...
Either I am doing it wrong, or Word for Mac can't be automated that way. Can anyone help with this script, or at least suggest a different method to print an envelope on demand?
Thanks...