home *** CD-ROM | disk | FTP | other *** search
- /*
- @BCopyBoxToPages @P@ICopyright Gold Disk Inc. February, 1992
-
- This Genie will copy a box and its contents to a range of pages.
- */
- address command
- call SafeEndEdit.rexx()
- call ppm_AutoUpdate(0)
- arg box, startpage, endpage
- pageoptions = "ODDEVENALL "
-
- if box = '' then
- do
- box = ppm_ClickOnBox("Click on the box to be copied..")
- if box = 0 then exit_msg()
- docstart = ppm_DocFirstPage()
- docend = ppm_DocLastPage()
-
- form = "Start Page:"docstart'0a'x "End Page:"docend'0a'x "ODD/EVEN/ALL"
- form = upper(ppm_GetForm("Enter options", 8, form))
- if form = '' then exit_msg()
-
- parse var form startpage '0a'x endpage '0a'x pageopts
-
- if endpage = '' then exit_msg('Invalid Range')
- if pageopts = '' then pageopts = 'ALL'
-
- if startpage < docstart then exit_msg('Invalid Range')
- else if startpage > docend then exit_msg('Invalid Range')
- if endpage < docstart then exit_msg('Invalid Range')
- else if endpage > docend then exit_msg('Invalid Range')
- if endpage < startpage then exit_msg('Invalid Range')
- end
-
- if upper(word(ppm_GetBoxInfo(box), 1)) = "TEXT" & ppm_TextOverFlow(box) then
- text = ppm_GetArticleText(box,1)
- else
- text = ''
-
- if datatype(startpage) ~= 'NUM' | datatype(endpage) ~= 'NUM' then
- call exit_msg("Invalid input")
-
- if verify(pageopts, pageoptions) ~= 0 then exit_msg("Invalid Input")
-
- opos = pos(pageopts, pageoptions)
-
- if opos = 4 then
- do
- increment = 2
- if (startpage // 2) then startpage = startpage + 1
- end
- else if opos = 1 then
- do
- increment = 2
- if ~(startpage // 2) then startpage = startpage + 1
- end
- else increment = 1
-
- do page = startpage to endpage by increment
-
- call ppm_ShowStatus("Working on page "page)
- newbox = ppm_CloneBox(box, 0, 0)
- call ppm_BoxChangePage(newbox, page)
-
- if text ~= '' then
- do
- call ppm_DeleteContents(newbox)
- call ppm_TextIntoBox(newbox, text)
- end
-
- end
-
- exit_msg()
-
- exit_msg: procedure
- do
- parse arg message
-
- if message ~= '' then
- call ppm_Inform(1,message,)
-
- call ppm_ClearStatus()
- call ppm_AutoUpdate(1)
- exit
- end
-
-