This Genie will import text and create as many pages (copies of the current page, if any) as necessary to fit the text. "Essays" have indented paragraphs with a half-line gap between them.
"Scripts" set margins as follows: paragraphs without codes are left unchanged; paragraphs beginning with a " are set as dialogue. Paragraphs beginning with : or ; are set as names of speakers. Character actions/manners of speaking are coded with a ( .
In all cases type is 14 point.
Written by Don Cox, Feb. 94, based on a Gold Disk original. Debug, June 94. Script format added Oct 94, Nov 94. Bug fixes Dec 94. Modified Feb 95. Bug fix, April 95. Bug fix, Sept. 95.
*/
/* $VER: AutoImportText Sept 95 */
/*call open("STDERR","ram:traceAIT","W")
trace r */
call SafeEndEdit.rexx()
call ppm_AutoUpdate(0)
currentunits = ppm_GetUnits()
call ppm_SetUnits(2)
address command
typesize = 14.000 /* You could change this */
bigtypesize = 24.000
currentpage = ppm_CurrentPage()
if currentpage ~= 0 then do /* Page exists, select box */
filename = ppm_GetFileName("Open Text File:", "", "")
if filename = '' then call exit_msg()
box = ppm_ClickOnBox("Click on box in which to import text")
end
else do /* No page exists, make from default */
filename = ppm_GetFileName("Open Text File:", "", "")
if filename = '' then call exit_msg()
currentpage = ppm_CreatePage(1,1,1,1,0)
box = ppm_PageFirstBox(currentpage)
if box = '' then call exit_msg("No box on default page, cannot import text.")
end
startpage = currentpage
if box = 0 then exit_msg("No box selected")
info = ppm_GetBoxInfo(box)
fword = upper(word(info, 1))
lword = word(info, words(info))
if (fword ~= "EMPTY" & lword ~= "0") then exit_msg("You must select an empty text box to use this Genie")
if word(info, 3) = 1 | word(info, 1) = word(info, 3) then leave
doparas = ppm_Inform(3, "Set paragraph indent?", "Essays", "Scripts", "No change")
donumbers = 1
if doparas = 2 then donumbers = ppm_Inform(2, "Number the pages?",,)
cpage = ppm_CurrentPage()
pagebox = 0 /* Is there a page number box already? */
testbox = ppm_PageFirstBox(cpage)
do until testbox=0
info = ppm_GetBoxInfo(box)
fword = upper(word(info, 1))
lword = word(info, words(info))
if upper(fword)="TEXT" then do
boxtxt = ppm_GetBoxText(testbox,1)
if (words(boxtxt)=2 & pos("Page \#<Pc0>",boxtxt)~=0) then pagebox = 1
end
if pagebox = 1 then numberbox = testbox
if pagebox = 1 then break
testbox = ppm_PageNextBox(testbox)
end
if (donumbers = 0 & pagebox = 1) then do
DeleteIt = ppm_Inform(2, "Delete existing Page number box?",,)
if DeleteIt = 1 then call ppm_DeleteBox(numberbox)