/*	Create_A_Fax_Template

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


OPTIONS FailAt 100
OPTIONS RESULTS

/* Default parameters */
faxname = "Liz Haynes"
position = "Sales Manager"
email = "sales@digita.com"
company = "Digita International Ltd."
address1 = "Rolle Street"
address2 = "Exmouth"
address3 = "Devon"
postcode = "EX8 1EY"
country = "England"
telephone = "01 395 270 273"
facsimile = "01 395 268 893"

sendname = "Sender's Name"
sendposition = "sender's postion"

recname = "Recipient's Name"
reccompany = "recipient's company"
rectelephone = "recipient's phone"
recfacsimile = "recipient's fax"

templatetype = "plain"
templatename = "WizardFaxTemplate"

/* Default contents */
deffaxname = ""
defposition = ""
defemail = ""
defcompany = ""
defaddress1 = ""
defaddress2 = ""
defaddress3 = ""
defpostcode = ""
defcountry = ""
deftelephone = ""
deffacsimile = ""

defsendname = ""
defsendposition = ""

defrecname = ""
defreccompany = ""
defrectelephone = ""
defrecfacsimile = ""

deftemplatename = ""


/* Start */
START:
WizardReq TITLE "Fax Template Wizard" LABEL "This Wizard will create a Fax template which can then be" LABEL "used with the New command (Project menu)." LABEL " Click Next or press Enter to continue to the next step" LABEL " click Previous to return to the previous step, if available" LABEL " click Cancel to quit without creating a fax or" LABEL " click Finish to create a fax using the default parameters." BUTTON 1 "_Next" BUTTON 3 "_Finish" BUTTON "-1" "_Cancel"
if (Result = -1) THEN
	EXIT
if (Result = 3) THEN
	SIGNAL FINISH	


/* Step 1 */
STEP1:
WizardReq TITLE "Fax Template Wizard" LABEL "What type of facsimile template would you like to produce." LABEL "" LABEL " Click Plain to produce a normal facsimile template," LABEL " Click Stylish to create a fancy looking facsimile." BUTTON 1 "P_lain" BUTTON 2 "_Stylish" BUTTON 3 "_Previous" BUTTON 4 "_Finish" BUTTON "-1" "_Cancel"
if (Result = "-1") THEN
	EXIT
if (Result = 1) THEN DO
	templatetype = "plain"
	SIGNAL STEP2
	END
if (Result = 2) THEN
 DO
	templatetype = "stylish"
	SIGNAL STEP2
	END
if (Result = 3) THEN
	SIGNAL START
if (Result = 4) THEN
	SIGNAL FINISH	


/* Step 2 */
STEP2:
WizardReq TITLE "Fax Template Wizard" LABEL "Please type in your personal details:" TEXTBOX 1 "N_ame:" CONTENTS deffaxname TEXTBOX 2 "P_osition:" CONTENTS defposition TEXTBOX 3 "_E-mail:" CONTENTS defemail BUTTON 1 "_Next" BUTTON 2 "_Previous" BUTTON 3 "_Finish" BUTTON "-1" "_Cancel"
buttonresult = Result
if (buttonresult = -1) THEN
	EXIT
if (buttonresult = 2) THEN
	SIGNAL STEP1
/* Get and store results */
Wizard_GetTextBox 1
faxname = Result
IF faxname = "" THEN
	faxname = sendname
Wizard_GetTextBox 2
position = Result
IF position = "" THEN
	position = sendposition
Wizard_GetTextBox 3
email = Result
if (buttonresult = 3) THEN
	SIGNAL FINISH	


/* Step 3 */
STEP3:
WizardReq TITLE "Fax Template Wizard" LABEL "Please type in your address:" TEXTBOX 1 "Compan_y:" CONTENTS defcompany TEXTBOX 2 "Address _1:" CONTENTS defaddress1 TEXTBOX 3 "Address _2:" CONTENTS defaddress2 TEXTBOX 4 "Address _3:" CONTENTS defaddress3 TEXTBOX 5 "P_ost Code:" CONTENTS defpostcode TEXTBOX 6 "Count_ry:" CONTENTS defcountry TEXTBOX 7 "_Telephone:" CONTENTS deftelephone TEXTBOX 8 "Fac_simile:" CONTENTS deffacsimile BUTTON 1 "_Next" BUTTON 2 "_Previous" BUTTON 3 "_Finish" BUTTON "-1" "_Cancel"
buttonresult = Result
if (buttonresult = -1) THEN
	EXIT
if (buttonresult = 2) THEN DO
	deffaxname = faxname
	defposition = position
	defemail = email
	SIGNAL STEP2
	END
/* Get and store results */
Wizard_GetTextBox 1
company = Result
Wizard_GetTextBox 2
address1 = Result
Wizard_GetTextBox 3
address2 = Result
Wizard_GetTextBox 4
address3 = Result
Wizard_GetTextBox 5
postcode = Result
Wizard_GetTextBox 6
country = Result
Wizard_GetTextBox 7
telephone = Result
Wizard_GetTextBox 8
facsimile = Result
if (buttonresult = 3) THEN
	SIGNAL FINISH	


/* Step 4 */
STEP4:
WizardReq TITLE "Fax Template Wizard" LABEL "Please type in the details of the fax recipient:" TEXTBOX 1 "N_ame:" CONTENTS defrecname TEXTBOX 2 "C_ompany:" CONTENTS defreccompany TEXTBOX 3 "_Telephone:" CONTENTS defrectelephone TEXTBOX 4 "Fac_simile:" CONTENTS defrecfacsimile BUTTON 1 "_Next" BUTTON 2 "_Previous" BUTTON 3 "_Finish" BUTTON "-1" "_Cancel"
buttonresult = Result
if (buttonresult = -1) THEN
	EXIT
if (buttonresult = 2) THEN DO
	defcompany = company
	defaddress1 = address1
	defaddress2 = address2
	defaddress3 = address3
	defpostcode = postcode
	defcountry = country
	deftelephone = telephone
	deffacsimile = facsimile
	SIGNAL STEP3
	END
/* Get and store results */
Wizard_GetTextBox 1
IF Result ~= "" THEN
	recname = Result
Wizard_GetTextBox 2
IF Result ~= "" THEN
	reccompany = Result
Wizard_GetTextBox 3
IF Result ~= "" THEN
	rectelephone = Result
Wizard_GetTextBox 4
IF Result ~= "" THEN
	recfacsimile = Result
if (buttonresult = 3) THEN
	SIGNAL FINISH	


/* Step 5 */
STEP5:
WizardReq TITLE "Fax Template Wizard" LABEL "Please type in the name that you would" LABEL "like to give the template:" TEXTBOX 1 "Template N_ame:" CONTENTS deftemplatename BUTTON 1 "_Next" BUTTON 2 "_Previous" BUTTON 3 "_Finish" BUTTON "-1" "_Cancel"
buttonresult = Result
if (buttonresult = -1) THEN
	EXIT
if (buttonresult = 2) THEN DO
	defrecname = recname
	defreccompany = reccompany
	defrectelephone = rectelephone
	defrecfacsimile = recfacsimile
	SIGNAL STEP4
	END
/* Get and store results */
Wizard_GetTextBox 1
IF Result ~= "" THEN
	templatename = Result
if (buttonresult = 3) THEN
	SIGNAL FINISH


/* Finished */
WizardReq TITLE "Fax Template Wizard - Creating" LABEL "The Fax template is finished requesting information from you." LABEL "" LABEL "Click Finish to create your fax template and save it to disk" LABEL "for future use." LABEL "" LABEL "Note: The creation of the fax may take a short while." BUTTON 1 "_Finish" BUTTON 2 "_Previous" BUTTON "-1" "_Cancel"
if (Result = -1) THEN
	EXIT
if (Result = 2) THEN DO
	deftemplatename = templatename
	SIGNAL STEP5
	END
if (Result = 1) THEN
	SIGNAL FINISH	


FINISH:
/* Create New document and set up margins */
New
faxportname = Result
ADDRESS VALUE faxportname
Document A4 "0.5in" "0.5in" "0.5in"

if (templatetype = "plain") THEN DO
	/* Create 'plain' fax template */
	Font NAME "Shannon Book"
	Font SIZE "20" BOLD WIDTH 600
	LeftJustify
	Text "Facsimile"
	Font SIZE "10" WIDTH 100
	NewParagraph
	NewParagraph

	SetTab LEFT "4cm"

	Font BOLD ITALIC
	Text "FROM:"
	Font PLAIN
	NewParagraph
	if faxname ~= "" THEN DO
		Text "Name:	"
		Text faxname
		NewParagraph
		END
	if position ~= "" THEN DO
		Text "Position:	"
		Text position
		NewParagraph
		END
	if company ~= "" THEN DO
		Text "Company:	"
		Text company
		NewParagraph
		END
	if address1 ~= "" THEN DO
		Text "Address:	"
		Text address1
		NewParagraph
		END
	if address2 ~= "" THEN DO
		Text "	"
		Text address2
		NewParagraph
		END
	if address3 ~= "" THEN DO
		Text "	"
		Text address3
		NewParagraph
		END
	if postcode ~= "" THEN DO
		Text "	"
		Text postcode
		NewParagraph
		END
	if country ~= "" THEN DO
		Text "	"
		Text country
		NewParagraph
		END
	if telephone ~= "" THEN DO
		Text "Telephone:	"
		Text telephone
		NewParagraph
		END
	if facsimile ~= "" THEN DO
		Text "Facsimile:	"
		Text facsimile
		NewParagraph
		END
	if email ~= "" THEN DO
		Text "E-mail:	"
		Text email
		NewParagraph
		END

	NewParagraph
	Font BOLD ITALIC
	Text "TO:"
	Font PLAIN
	NewParagraph
	Text "Name:	"
	Text recname
	NewParagraph
	if reccompany ~= "" THEN DO
		Text "Company:	"
		Text reccompany
		NewParagraph
		END
	Text "Telephone:	"
	Text rectelephone
	NewParagraph
	Text "Facsimile:	"
	Text recfacsimile
	NewParagraph
	NewParagraph
	Text "Date:	"
	InsertUpdatingDate
	NewParagraph
	Text "Pages:	  (including this one)"
	NewParagraph
	NewParagraph
	END

if (templatetype = "stylish") THEN DO
	/* Create 'stylish' fax template */
	Font NAME "Shannon Book"
	Font SIZE "20" BOLD WIDTH 600
	CentreJustify
	Text "Facsimile"
	Font SIZE "10" PLAIN WIDTH 100
	NewParagraph
	NewParagraph
	if company ~= "" THEN DO
		Text company
		Text "   "
		END
	if address1 ~= "" THEN DO
		Text address1
		Text "   "
		END
	if address2 ~= "" THEN DO
		Text address2
		Text "   "
		END
	if address3 ~= "" THEN DO
		Text address3
		Text "   "
		END
	if postcode ~= "" THEN DO
		Text postcode
		Text "   "
		END
	if country ~= "" THEN DO
		Text country
		END
	NewParagraph
	Font ITALIC
	if telephone ~= "" THEN DO
		Text "Telephone: "
		Text telephone
		END
	if facsimile ~= "" THEN DO
		Text "   "
		Text "Facsimile: "
		Text facsimile
		END
	if email ~= "" THEN DO
		Text "   "
		Text "E-mail: "
		Text email
		END
	
	Font PLAIN
	NewParagraph
	
	LeftJustify
	NewParagraph
	NewParagraph
	
	SetTab RIGHT "4cm"
	SetTab LEFT "4.5cm"
	SetTab LEFT "10cm"
	SetTab RIGHT "13cm"
	SetTab LEFT "13.5cm"
	Font BOLD
	Text "TO"
	Font PLAIN
	Text "	Name:	"
	Font SMALLCAPS
	Text recname
	Font SMALLCAPS
	Text "	"
	Font BOLD
	Text "FROM"
	Font PLAIN
	Text "	Name:	"
	Font SMALLCAPS
	Text faxname
	Font SMALLCAPS
	NewParagraph
	
	Text "	Company:	"
	Text reccompany
	Text "		"
	Text "Position:	"
	Text position
	NewParagraph
	
	Text "	Telephone:	"
	Text rectelephone
	Text "		"
	Text "Date:	"
	InsertUpdatingDate
	NewParagraph
	
	Text "	Facsimile:	"
	Text recfacsimile
	Text "		"
	Text "Pages:	"
	NewParagraph
	NewParagraph
	
	DrawLine 1 "2.54cm" "6.35cm" "18.5cm" "6.35cm" 2 "60% Grey"
	END


/* Go to main page */
CtrlDown
NewParagraph

SAVEAS TEMPLATE NAME templatename

RequestNotify PROMPT "The Fax Template Wizard has finished."
End
