/*	Create_A_Memo

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


OPTIONS FailAt 100
OPTIONS RESULTS

/* Default parameters */
deffromname = ""
deftoname = ""
defsubject = ""

defccname = "Other Recipient"

memofromname = "Sender's Name"
memotoname = "Recipient's Name"
memosubject = "Subject"
fromname = memofromname
toname = memotoname
subject = memosubject

ccon = 0


START:
WizardReq TITLE "Memo Wizard" LABEL "This Wizard will create an Office Memorandum for you." LABEL "" 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 memo or" LABEL " click Finish to create a memo using the default parameters." BUTTON 1 "_Next" BUTTON 2 "_Finish" BUTTON "-1" "_Cancel"
If Result = -1 THEN
	EXIT
IF Result = 2 THEN
	SIGNAL MAKEMEMO


/* Step 1 */
STEP1:
WizardReq TITLE "Memo Wizard" LABEL "Please type your name:" TEXTBOX 1 "N_ame:" CONTENTS deffromname BUTTON 1 "_Next" BUTTON 2 "_Previous" BUTTON 3 "_Finish" BUTTON "-1" "_Cancel"
buttonresult = Result
If buttonresult = -1 THEN
	EXIT
If buttonresult = 2 THEN
	SIGNAL START

Wizard_GetTextBox 1
fromname = Result
if fromname = "" THEN
	fromname = memofromname

If buttonresult = 3 THEN
	SIGNAL MAKEMEMO


/* Step 2 */
STEP2:
WizardReq TITLE "Memo Wizard" LABEL "Please type the recipient's name:" TEXTBOX 1 "N_ame:" CONTENTS deftoname BUTTON 1 "_Next" BUTTON 2 "_Previous" BUTTON 3 "_Finish" BUTTON "-1" "_Cancel"
buttonresult = Result
If buttonresult = -1 THEN
	Exit
If buttonresult = 2 THEN DO
	deffromname = fromname
	SIGNAL STEP1
	END

Wizard_GetTextBox 1
toname = Result
if toname = "" THEN
	toname = memotoname

If buttonresult = 3 THEN
	SIGNAL MAKEMEMO


/* Step 3 */
STEP3:
WizardReq TITLE "Memo Wizard" LABEL "Please type the subject of the memo:" TEXTBOX 1 "_Subject:" CONTENTS defsubject BUTTON 1 "_Next" BUTTON 2 "_Previous" BUTTON 3 "_Finish" BUTTON "-1" "_Cancel"
buttonresult = Result
If buttonresult = -1 THEN
	Exit
If buttonresult = 2 THEN DO
	deftoname = toname
	SIGNAL STEP2
	END

Wizard_GetTextBox 1
subject = Result
if subject = "" THEN
	subject = memosubject

if buttonresult = 3 THEN
	SIGNAL MAKEMEMO


STEP4:
WizardReq TITLE "Memo Wizard" LABEL "Do you want copies of the memo" LABEL "to go to anyone else?" BUTTON 1 "_Yes" BUTTON 2 "_No" BUTTON "-1" "_Cancel"
buttonresult = Result
If buttonresult = -1 THEN
	Exit
IF buttonresult = 1 THEN DO
	ccon = 1
	ccnum = 0
	ccname. = ""
	Finished = 0
	DO WHILE Finished = 0
		ccnum = ccnum + 1
		WizardReq TITLE "Memo Wizard" LABEL "Please type the name of someone that" LABEL "is to receive a copy of the memo:" TEXTBOX 1 "Nam_e:" BUTTON 1 "_Another" BUTTON 2 "No _More" BUTTON "-1" "_Cancel"
		ccbuttonresult = Result
		If ccbuttonresult = -1 THEN
			Exit

		Wizard_GetTextBox 1
		ccname.ccnum = Result
		if Result = "" THEN
			ccname.ccnum = defccname

		If ccbuttonresult = 2 THEN
			Finished = 1
	END
END
IF buttonresult = 2 THEN
	ccon = 0


/* Create Memorandum */
MAKEMEMO:
New
ADDRESS VALUE Result
/* Create New document and set up margins */
Document A4 "0.5in" "0.5in" "0.6in" "1.0in"
Paragraph 0 0 0 LEFT AUTO SINGLE NONE NONE
SetTab Left "3.55cm"
SetTab Right "3cm"

Font NAME "Shannon Book" SIZE "17" WIDTH 400
Bold
SmallCaps
Text 'Memorandum'
SmallCaps
NewParagraph

Font NAME "Shannon Book" SIZE "12" WIDTH 100
NewParagraph

Text '	To:	'
Plain
Text ToName
NewParagraph

Bold
Text '	From:	'
Plain
Text FromName
NewParagraph

Bold
Text '	Date:	'
Plain
InsertDate
NewParagraph

Bold
Text '	Subject:	'
Plain
Text Subject
NewParagraph

IF ccon = 1 THEN DO
	NewParagraph
	NewParagraph
	Bold
	Italic
	Text '	CC:	'
	Plain
	Italic
	count = 0
	DO WHILE count ~= ccnum
		count = count + 1
		Text ccname.count
		Text "   "
	END
	DrawLine 1 "0.5in" "2.6in" "7.77in" "2.6in" "2pt" "60% Grey"
	Plain
END
ELSE
	DrawLine 1 "0.5in" "2.1in" "7.77in" "2.1in" "2pt" "60% Grey"

NewParagraph
NewParagraph
NewParagraph

RequestNotify PROMPT "The Memo Wizard has finished."
End
