home *** CD-ROM | disk | FTP | other *** search
- /*
- @BGetTaggedText @P@ICopyright Gold Disk Inc., Jan, 1993
-
- This Genie will copy all text with a given style tag into a previously created box. (Suitable for automatic table of contents generation.)
-
- */
- address command
- call SafeEndEdit.rexx()
- call ppm_AutoUpdate(0)
- cr = '0a'x
-
- stlist = ppm_GetStyleTagList()
- if stlist = "0"'0a'x then exit_msg("No tags are defined in current document.")
-
- stlist = delstr(stlist, 1, pos('0a'x, stlist))
-
- tags = ppm_SelectFromList("Select tags to collect..", 30, 5, 1, stlist)
-
- if tags = '' then exit_msg()
-
- output = ppm_ClickOnBox("Select Box in which to place tagged text..")
- if output = 0 then exit_msg()
-
- counter = 0
- call ppm_ShowStatus("Working..")
-
- do while tags ~= ''
-
- counter = counter + 1
- parse var tags tagitem.counter '0a'x tags
-
- end
-
- listcounter = 1
- bcounter = 1
-
- box = ppm_DocFirstBox()
-
- call ppm_ShowStatus("Working..")
-
- do while box ~= 0
-
- if upper(word(ppm_GetBoxInfo(box), 1)) ~= 'TEXT' then
- do
- box = ppm_DocNextBox(box)
- iterate
- end
-
- boxtext = ppm_GetBoxText(box, 1)
- tagpos = pos('\dS<', boxtext)
-
- do while tagpos ~= 0
-
- tagpos = tagpos + 4
- endtag = pos('>', boxtext, tagpos)
-
- if endtag = 0 then leave
-
- tagtext = substr(boxtext, tagpos, endtag - tagpos)
-
- do i = 1 to counter
-
- if tagtext ~= tagitem.i then iterate
-
- endpos = pos('\ds', boxtext, endtag)
-
- if endpos = 0 then
- do
- endpos = pos('0a'x, boxtext, endtag + 1)
-
- if endpos = 0 then
- endpos = pos('\.', boxtext, endtag + 1)
- end
-
- tagtext = "\dS<"tagtext">"
- taglist.listcounter = tagtext || substr(boxtext, endtag + 1, endpos - 1 - endtag) || "\ds"
- taglist.listcounter.1 = ppm_BoxPage(box)
-
- listcounter = listcounter + 1
-
- tagpos = endpos + 3
- leave
-
- end
-
- tagpos = pos('\dS<', boxtext, tagpos)
-
- end
-
- box = ppm_DocNextBox(box)
-
- end
-
- text = ''
-
- do i = 1 to listcounter - 1
-
- text = text || taglist.i || '09'x || taglist.i.1 || cr
-
- end
-
- call SafeSetEdit.rexx(output)
- call ppm_InsertText(text)
- call SafeEndEdit.rexx()
-
-
- exit_msg("Done")
-
- exit_msg: procedure
- do
-
- parse arg message
-
- if message ~= '' then call ppm_Inform(1,message,)
-
- call ppm_AutoUpdate(1)
- exit
- end
-