/*	Mail_Merge_Tutorial

		Digita Wizard Script for Wordworth 7
		Copyright 1998, Digita International Ltd.
		
		Created: 19 January 1996
		Author:  Mark Jackson
*/


OPTIONS RESULTS


OldPortName = Address()

WizardReq TITLE "Mail Merge Wizard" LABEL "This wizard will show you how to use" LABEL "Wordworth's Mail Merging feature." LABEL "" BUTTON 1 "_OK" BUTTON "-1" "_Cancel"
If Result = -1 THEN
	Exit

If Result = 1 THEN

/* Demo */

WizardReq TITLE "Mail Merge Wizard" LABEL "First we need to create a data file" LABEL "containing the mail merge information." LABEL "You can export this from a database" LABEL "program, e.g. Datastore, but we will" LABEL "create it in Wordworth" BUTTON 1 "_OK" BUTTON "-1" "_Cancel"
If Result = -1 THEN
	Exit

New
Address Value Result

Document A4 "0.5in" "0.5in" "0.6in" "1.0in"

Font NAME "Shannon Book" SIZE 12

WizardReq TITLE "Mail Merge Wizard" LABEL "We will have 5 fields in our example" LABEL "database. First we'll set up some" LABEL "tabs, so the text is nicely laid out." LABEL "You would do this by simply clicking" LABEL "on the horizontal ruler." BUTTON 1 "_OK" BUTTON "-1" "_Cancel"
If Result = -1 THEN DO
	Close FORCE
	Exit
END

SetTab LEFT "2in"
SetTab LEFT "3.5in"
SetTab LEFT "5in"
SetTab LEFT "6.5in"

WizardReq TITLE "Mail Merge Wizard" LABEL "Each field must be seperated by a Tab," LABEL "with a Return at the end of each record." LABEL "The first line gives names to the different" LABEL "fields, we'll enter this information first." BUTTON 1 "_OK" BUTTON "-1" "_Cancel"
If Result = -1 THEN DO
	Close FORCE
	Exit
END

Text 'Name	Street	Town	County	Postcode'
NewParagraph

WizardReq TITLE "Mail Merge Wizard" LABEL "Now we need to enter the actual" LABEL "data into the fields." LABEL "You can create as many records" LABEL "as you like, we'll make 3." BUTTON 1 "_OK" BUTTON "-1" "_Cancel"
If Result = -1 THEN DO
	Close FORCE
	Exit
END

Text 'Mr Smith	13 Park Avenue	Norwich	Norfolk	NE11 4BD'
NewParagraph
Text 'Mr Jones	7 Main Road	Exmouth	Devon	EX8 1JL'
NewParagraph
Text 'Mrs Simpson	41 Church Street	Taunton	Somerset	TA24 7PP'

WizardReq TITLE "Mail Merge Wizard" LABEL "Next we need to save the file" LABEL "in ASCII format" BUTTON 1 "_OK" BUTTON "-1" "_Cancel"
If Result = -1 THEN DO
	Close FORCE
	Exit
END

Saveas ASCII NAME "MergeData"

WizardReq TITLE "Mail Merge Wizard" LABEL "Now the data file has been" LABEL "created and saved, we will need" LABEL "to create the document we wish" LABEL "to merge it with." BUTTON 1 "_OK" BUTTON "-1" "_Cancel"
If Result = -1 THEN DO
	Close FORCE
	Exit
END

Close FORCE

Address Value OldPortName

New
Address Value Result

Document A4 "0.5in" "0.5in" "0.6in" "1.0in"

Font NAME "Shannon Book" SIZE 12

WizardReq TITLE "Mail Merge Wizard" LABEL "We'll type a standard letter, but tell" LABEL "Wordworth to insert the fields in" LABEL "the data file at the appropriate places" LABEL "by entering the field names, surrounded" LABEL "by the mail merge symbols '' and ''." BUTTON 1 "_OK" BUTTON "-1" "_Cancel"
If Result = -1 THEN DO
	Close FORCE
	Exit
END

RightJustify
Text 'Digita International Ltd.'
NewParagraph
Text 'Black Horse House'
NewParagraph
Text 'Exmouth'
NewParagraph
Text 'Devon'
NewParagraph
Text 'EX8 1JL'
NewParagraph
Paragraph 0 0 0 RIGHT AUTO SINGLE NONE "6 pt"
Text 'ENGLAND'
NewParagraph
Paragraph 0 0 0 RIGHT AUTO SINGLE NONE NONE
Text 'Tel: (01 395) 270 273'
NewParagraph
LeftJustify
NewParagraph
Text 'Name'
NewParagraph
Text 'Street'
NewParagraph
Text 'Town'
NewParagraph
Text 'County'
NewParagraph
Text 'Postcode'
NewParagraph
NewParagraph
Text 'Dear Name,'
NewParagraph
NewParagraph
Paragraph 0 0 0 LEFT AUTO SINGLE NONE "6 pt"
Text 'We at Digita would like to thank you for buying Wordworth 5, the premier Word Processing package for the Amiga.'
NewParagraph
Text 'We also publish many other programs on the Amiga - Organiser 2 is a Personal Information Manager (PIM) '
Text 'which helps you keep organised. Datastore 2 is a flat-file Database program which you can use to store '
Text 'any type of information, for example a database of clients and their addresses, or your CD collection. '
Text 'Money Matters 4 is a personal finance program for keeping track of your accounts. We also distribute the '
Text 'English versions of Personal Paint 6.4, a powerful painting and image processing package, and TurboCalc 3.5, '
Text 'a Spreadsheet program.'
Paragraph 0 0 0 LEFT AUTO SINGLE NONE NONE
NewParagraph
NewParagraph
Text 'Best regards,'
NewParagraph
NewParagraph
NewParagraph
NewParagraph
NewParagraph
Text 'Jeremy Rihll'
NewParagraph
Text 'Director.'
Newparagraph

WizardReq TITLE "Mail Merge Wizard" LABEL "Now we'll mail merge this document" LABEL "with the data file we created earlier." BUTTON 1 "_OK" BUTTON "-1" "_Cancel"
If Result = -1 THEN DO
	Close FORCE
	Exit
END

MailMerge DATASTORE HEADER DATAFILE "MergeData"

WizardReq TITLE "Mail Merge Wizard" LABEL "That's it!" LABEL "" LABEL "Now try creating your own" LABEL "Mail merge documents." BUTTON 1 "_OK" BUTTON "-1" "_Cancel"
If Result = -1 THEN DO
	Close FORCE
	Exit
END

Close FORCE
