/* ReplaceBoxesOnPages This Genie will replace each box at a particular position on a range of pages. You will be prompted to select the box which occurs at a position on the range of pages. The box you click on will replace all boxes in the page range which are in exactly the same position, as defined by the top left corner. Written by Don Cox May '92. Not Public Domain. All rights reserved. */ cr = '0a'x pageopts = "OODDEEVENAALL" address command call SafeEndEdit.rexx() call ppm_AutoUpdate(0) counter = 0 signal on error signal on syntax boxpos = ppm_GetClickPosition("Click on box to be copied to each page") originalpage = ppm_CurrentPage() boxtop = word(boxpos, 2) boxleft = word(boxpos, 1) box = ppm_BoxAtPosn(boxleft, boxtop) if box = 0 then exit_msg() if upper(word(ppm_GetBoxInfo(box), 1)) = "TEXT" & ppm_TextOverFlow(box) then text = ppm_GetArticleText(box,1) else text = '' docstart = ppm_DocFirstPage() docend = ppm_DocLastPage() pages = upper(ppm_GetForm("Enter range of pages", 20, "From:"docstart'0a'x "To:"docend'0a'x "ODD/EVEN/ALL")) if pages = '' then exit_msg() parse var pages startpage '0a'x endpage '0a'x pageopt if (startpage ~= '' & datatype(startpage) ~= NUM) | (endpage ~= '' & datatype(endpage) ~= NUM ) then exit_msg("Invalid Input") increment = 1 /* * Check error conditions */ 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') if pageopt = 'ALL' | pageopt = 'A' then do increment = 1 end else if pageopt = 'EVEN' | pageopt = 'E' then do increment = 2 if (startpage // 2) then startpage = startpage + 1 end else if pageopt = 'ODD' | pageopt = 'O' then do increment = 2 if ~(startpage // 2) then startpage = startpage + 1 end if startpage > endpage then do temp = startpage startpage = endpage endpage = temp end do page = startpage to endpage by increment if page ~= originalpage then do call ppm_ShowStatus("Working on page "page) deadbox = ppm_BoxAtPosn(boxleft,boxtop,page) if deadbox ~= 0 then do 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 gone = ppm_DeleteBox(deadbox) end 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