home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 5 Edit
/
05-Edit.zip
/
desenvel.zip
/
LetterPrompts
(
.txt
)
< prev
next >
Wrap
DeScribe Document
|
1994-12-28
|
47KB
|
383 lines
DeScribe Copyright DeScribe, Inc., 1988, 1989
Info 1
Info 2
Info 3
Info 4
Macro
Courier
! This macro constructs a multi-field dialog by looking through
! a document for fields of the form <<Field name>>
var descrip
var field
var field1
var field2
var field3
var field4
var field5
var field6
var static
var static1
var s
tatic2
var s
tatic3
var s
tatic4
var static5
var static6
var varNum
var savedFrame
var savedPos
var nextPos
var beginPos
var endPos
var replaced
var found
var done
var selected
var duplicate
var justLooking
procedure CompareStatics
if varNum > 1 then
if static = static1 then
set duplicate to TRUE
return
end if
end if
if varNum > 2 then
if static = static2 then
set duplicate to TRUE
return
end if
end if
if varNum > 3 then
if static = static3 then
set duplicate to TRUE
return
end if
end if
if varNum > 4 then
if static = static4 then
set duplicate to TRUE
return
end if
end if
if varNum > 5 then
if static = static5 then
set duplicate to TRUE
return
end if
end if
end procedure
procedure CheckDuplicate
set duplicate to FALSE
call CompareStatics
end procedure
procedure SetPrompt
call CheckDuplicate
if duplicate then
return
end if
if varNum = 1 then
set static1 to static
MSET static tostring field1
return
end if
if v
arNum = 2 then
set static2 to static
MSET static tostring field2
return
end if
if v
arNum = 3 then
set static3 to static
MSET static tostring field3
return
end if
if v
arNum = 4 then
set static4 to static
MSET static tostring field4
return
end if
if v
arNum = 5 then
set static5 to static
MSET static tostring field5
return
end if
if varNum = 6 then
set static6 to static
MSET static tostring field6
return
end if
end procedure
procedure GetField
if replaced = 1 then
set field to field1
set static to static1
return
end if
if replaced = 2 then
set field to field2
set static to static2
return
end if
if replaced = 3 then
set field to field3
set static to static3
return
end if
if replaced = 4 then
set field to field4
set static to static4
return
end if
if replaced = 5 then
set field to field5
set static to static5
return
end if
if replaced = 6 then
set field to field6
set static to static6
return
end if
end procedure
procedure SetStatic
set FirstDefinedPosition to beginPos
set LastDefinedPosition to endPos
CopyToClipboard
set static to PastedClipboard
end procedure
procedure doReplace
Call GetField
if field =
then
return
end if
set static to
+ static
set static to static +
SearchClear
SET SearchSearch1 to static
if field =
then
SET SearchDeleteOnFound1 to TRUE
else
SET SearchReplace1 to field
end if
SET SearchConfirm1 to FALSE
SearchForward
if field =
then
end if
end procedure
procedure removeOpenEvent
set DocEventOpenMacro to
end procedure
procedure FindField
set found to FALSE
set done to FALSE
set CursorPosition to nextPos
SearchForward
if not DefinedBlock then
set done to TRUE
return
end if
CancelDefinedBlock
if CursorCharacter =
then
CursorRight
if CursorCharacter =
then
set beginPos to CursorPosition + 1
SearchForward
if not DefinedBlock then
set done to TRUE
return
end if
CancelDefinedBlock
if CursorCharacter =
then
CursorRight
if CursorCharacter =
then
set nextPos to CursorPosition + 1
set endPos to CursorPosition - 2
set selected to endPos - beginPos
if selected < 256 then
set found to TRUE
if not justLooking then
Call SetStatic
end if
return
end if
end if
end if
end if
end if
set nextPos to CursorPosition + 1
end procedure
procedure SearchFrames
SearchClear
set SearchSearch1 to "<<"
set SearchSearch2 to ">>"
set savedFrame to SelectedFrame
repeat
NextFrame
if not IsFrameTypePicture then
set savedPos to CursorPosition
CursorHome
set nextPos to CursorPosition
repeat
call FindField
exit when done
if found then
if not justLooking then
Call SetPrompt
end if
if not duplicate then
set v
arNum to v
arNum + 1
if justLooking then
return
end if
end if
if varNum > 7 then
msg
More than 6 fields in document. Field Prompter could not substitute all fields.
exit
end if
end if
end repeat
Set CursorPosition to savedPos
end if
exit when savedFrame = SelectedFrame
end repeat
end procedure
Procedure EnvelopCreate
NewDocumentFile "G:\DeScribe\Layouts\Sobre - Paz"
SET SelectedFrame TO "Address"
SET CursorPosition TO 0
set varNum to 1
set justLooking to FALSE
Call SearchFrames
if varNum = 1 then
set SelectedFrame to savedFrame
set CursorPosition to savedPos
quit
end if
set SelectedFrame to savedFrame
set replaced to 1
set savedFrame to SelectedFrame
repeat
NextFrame
if not IsFrameTypePicture then
set replaced to 1
repeat
Call doReplace
set replaced to replaced + 1
exit when replaced = varNum
end repeat
Set CursorPosition to savedPos
end if
exit when savedFrame = SelectedFrame
end repeat
set varNum to 1
set justLooking to TRUE
Call SearchFrames
if varNum = 1 then
Call removeOpenEvent
end if
set SelectedFrame to savedFrame
set CursorPosition to savedPos
end procedure
Procedure GetDescriptn
set MacroDialogTitle to
Field Prompter
set descrip to
Fill in the prompts to replace text in brackets.
set descrip to descrip +
Type an asterisk
to leave the corresponding text and brackets unchanged.
set descrip to descrip +
Blank fields will be deleted. Press Cancel to leave document as is.
mget descrip
end procedure
MACRO FieldPrompt
set varNum to 1
set justLooking to FALSE
Call SearchFrames
if varNum = 1 then
set SelectedFrame to savedFrame
set CursorPosition to savedPos
quit
end if
set SelectedFrame to savedFrame
! set MacroDialogTitle to
Field Prompter
! set descrip to
Fill in the prompts to replace text in brackets.
! set descrip to descrip +
Type an asterisk
to leave the c
ng text and brackets unchanged.
! set descrip to descrip +
Blank fields will be deleted. Press Cancel to leave document as is.
! mget descrip
Call GetDescriptn
set replaced to 1
set savedFrame to SelectedFrame
repeat
NextFrame
if not IsFrameTypePicture then
set replaced to 1
CursorHome
repeat
Call doReplace
set replaced to replaced + 1
exit when replaced = varNum
end repeat
Set CursorPosition to savedPos
end if
exit when savedFrame = SelectedFrame
end repeat
set v
arNum to 1
set justLooking to TRUE
Call SearchFrames
if varNum = 1 then
Call removeOpenEvent
end if
set SelectedFrame to savedFrame
set CursorPosition to savedPos
Call EnvelopCreate
END MACRO
DeScribe Glossary
Create date
Create time
Document name
File name
Pages
Pages (Alphabetic lower case)
Pages (Alphabetic upper case)
Pages (Roman lower case)
Pages (Roman upper case)
Print date
Print time
Revisions
Save date
Save time
4 August 1994
12:50 P.M.
LetterPrompts
G:\DeScribe\Macros\LetterPrompts
28 December 1994
4:39 P.M.
28 December 1994
5:42 P.M.