/* Print Envelope v1.0, for Wordworth v5 by Ryan Morse. $VER: Print_Envelope_Macro v1.0 (14-6-96) This macro is part of the PrintPlus (© Ryan Morse) Wordworth ARexx enhancement set. INSTRUCTIONS: Select the address in your letter and then run this macro. */ /* Return results for buttons */ OPTIONS RESULTS CONTROLPANEL: /* Notify user */ WIZARDREQ TITLE 'Print Envelope, by Ryan Morse © 1996.' LABEL 'This macro will print the current letter and an envelope' LABEL 'using the currently selected address.' LABEL 'For a mail merge address, type in the data file:' TEXTBOX 1 '_Data File:' BUTTON 1 '_Print' BUTTON 2 '_Mail Merge' BUTTON '-1' '_Cancel' /* BUTTONS */ /* Create variable for result of button */ ButtonResult = RESULT /* Cancel button */ IF ButtonResult = -1 THEN DO REQUESTNOTIFY 'AREXX MACRO CANCELLED.' EXIT END /* GET SELECTED TEXT */ /* Get text */ GETTEXT Address = RESULT /* Print button */ IF ButtonResult = 1 THEN DO /* PRINT LETTER */ PRINT /* CREATE ENVELOPE */ NEW PORTNAME Envelope ADDRESS Envelope /* Set envelope size to DL */ DOCUMENT '220mm' '110mm' '0.2in' '0.2in' '1in' '1in' 1 '0.2in' LANDSCAPEOFF /* NOTE: I can not get Wordworth to accept the document width or height, this may be a bug. For now enter the document size manually. */ /* Notify user */ WIZARDREQ Title 'Set Envelope Size.' LABEL 'Set the document size to suit your envelope.' LABEL 'DL Envelope = Width: 220mm and Height: 110mm.' LABEL 'C5 Envelope = Width: 229mm and Height: 162mm.' LABEL 'Enable the LANDSCAPE option depending on your preference.' BUTTON 1 '_Ok' BUTTON '-1' '_Cancel' /* Cancel button */ IF RESULT = -1 THEN DO REQUESTNOTIFY 'AREXX MACRO CANCELLED.' CLOSE FORCE EXIT END DOCUMENT /* Draw text frame for address */ WIZARDREQ Title 'Set Text Frame Size for Address.' LABEL 'Draw a text frame for the address.' LABEL 'Use the current settings for a DL envelope.' TEXTBOX 1 'From _Left:' CONTENTS '1.38in' TEXTBOX 2 'From _Top:' CONTENTS '1.50in' TEXTBOX 3 '_Width:' CONTENTS '4.00in' TEXTBOX 4 '_Height:' CONTENTS '1.80in' BUTTON 1 '_Ok' BUTTON '-1' '_Cancel' /* Cancel button */ IF RESULT = -1 THEN DO REQUESTNOTIFY 'AREXX MACRO CANCELLED.' CLOSE FORCE EXIT END /* GET MEASUREMENTS */ DO n=1 TO 4 WIZARD_GETTEXTBOX n MEASUREMENT.n = RESULT END DRAWTEXTFRAME 1 MEASUREMENT.1 MEASUREMENT.2 MEASUREMENT.3 MEASUREMENT.4 '0.05in' '0.05in' '0.05in' '0.05in' TRANSPARENT NONE TextFrame = RESULT /* Insert address */ ACTIVATETEXTFRAME TextFrame FONT SIZE 10 TEXT Address /* PRINT ENVELOPE */ PRINT /* Close Envelope */ CLOSE FORCE END /* Mail merge button */ IF ButtonResult = 2 THEN DO /* OBTAIN DETAILS */ /* Get name and path of data file */ WIZARD_GETTEXTBOX 1 DFile = RESULT /* CHECK FOR DATA FILE */ /* The default location is in the Wordworth drawer, not the documents drawer */ /* If DataFile does not exist then notify user */ IF ~EXISTS('' || DFile || '') THEN DO REQUESTNOTIFY 'Data file:' DFile 'does not exist. Try entering its path.' SIGNAL CONTROLPANEL END /* MAIL MERGE LETTER */ /* Mail merge with DataFile */ MAILMERGE DATASTORE HEADER DATAFILE DFile /* CREATE ENVELOPE */ NEW PORTNAME Envelope ADDRESS Envelope /* Set envelope size to DL */ DOCUMENT '220mm' '110mm' '0.2in' '0.2in' '1in' '1in' 1 '0.2in' LANDSCAPEOFF /* NOTE: I can not get Wordworth to accept the document width or height, this may be a bug. For now enter the document size manually. */ /* Notify user */ WIZARDREQ Title 'Set Envelope Size.' LABEL 'Set the document size to suit your envelope.' LABEL 'DL Envelope = Width: 220mm and Height: 110mm.' LABEL 'C5 Envelope = Width: 229mm and Height: 162mm.' LABEL 'Enable the LANDSCAPE option depending on your preference.' BUTTON 1 '_Ok' BUTTON '-1' '_Cancel' /* Cancel button */ IF RESULT = -1 THEN DO REQUESTNOTIFY 'AREXX MACRO CANCELLED.' CLOSE FORCE EXIT END DOCUMENT /* Draw text frame for address */ WIZARDREQ Title 'Set Text Frame Size for Address.' LABEL 'Draw a text frame for the address.' LABEL 'Use the current settings for a DL envelope.' TEXTBOX 1 'From _Left:' CONTENTS '1.38in' TEXTBOX 2 'From _Top:' CONTENTS '1.50in' TEXTBOX 3 '_Width:' CONTENTS '4.00in' TEXTBOX 4 '_Height:' CONTENTS '1.80in' BUTTON 1 '_Ok' BUTTON '-1' '_Cancel' /* Cancel button */ IF RESULT = -1 THEN DO REQUESTNOTIFY 'AREXX MACRO CANCELLED.' CLOSE FORCE EXIT END /* GET MEASUREMENTS */ DO n=1 TO 4 WIZARD_GETTEXTBOX n MEASUREMENT.n = RESULT END DRAWTEXTFRAME 1 MEASUREMENT.1 MEASUREMENT.2 MEASUREMENT.3 MEASUREMENT.4 '0.05in' '0.05in' '0.05in' '0.05in' TRANSPARENT NONE TextFrame = RESULT /* Insert address */ ACTIVATETEXTFRAME TextFrame FONT SIZE 10 TEXT Address /* MAIL MERGE ENVELOPE */ /* Mail merge with DataFile */ MAILMERGE DATASTORE HEADER DATAFILE DFile /* Close Envelope */ CLOSE FORCE END