Automatic Envelope Creation

Have a problem? A question? This is the place for answers from other Express users.
Post Reply
afragen
Posts: 6
Joined: 2003-04-30 13:01:17

Automatic Envelope Creation

Post by afragen »

For everyone who misses automatic envelope creation, I have a working solution.

First create a new document.
Change the Page Setup to be '#10 Envelope' or whatever you envelope style as listed is and select the correct orientation for your printer.
Set the margins as follows (for #10 Envelope)
inner - 3.5in
outer - 2.0in
top - 1.65in
bottom - 0.95in

Note: I left the default headers/footer alone at 0.5in
Save this document as "envelope.rtf" in the "~/Documents/Nisus Documents" folder.
From the Finder, do a Get Info on "envelope.rft" and check 'Stationary Pad'

I create the envelope by calling an AppleScript from the macro menu that, in turn, calls a second AppleScript. Don't ask why it doesn't work from a single script -- it doesn't.

Here's the first script.

<applescript>
tell application "Finder"
set scriptPath to (((path to application support from user domain) as string) & "Nisus Writer:Macros:Envelope Maker.app") as alias
open scriptPath
end tell
</applescript>

Save this as "Envelope…", type Script, in the NWE Macros folder. Yes, that's an ellipsis.

Here's the second script.

<applescript>
tell application "Nisus Writer Express"
set docName to name of front window
get selected text of front document
set addressee to the result

tell application "Finder"
set myDocs to path to documents folder as string
open document file (myDocs & "Nisus Documents:envelope.rtf")
delay 1
end tell

activate
set envelopeName to name of front window
set text of document envelopeName to addressee

--clean up
set envelopePath to myDocs & "Nisus Documents:" & envelopeName
tell application "Finder"
move file envelopePath to trash
end tell
end tell
</applescript>

Save this as "Envelope Maker", type application, uncheck Startup Screen, in the NWE macros folder.

Now, making it work.

Select/highlight the complete address in any open document that you want an envelope made and then choose "Envelope…" from the Macro menu. A new envelope document will be created, brought to the front and the address inserted. Print it. The envelope document will be moved automatically to the Finder trash.

Enjoy.
Andy Fragen
Post Reply