richtext reformatting


[ Zettels Traum ] [ search / suche ]


>I have 300+ RTF cast members that I would like to reformat, with a
>different font and size.
>
>>From what I've read in the archives, it sounds like I can create a
>"template" RTF member, and then copy the text into it, automatically
>formatting based on that new style.  This works by hand, but how can I
>batch automate this process in Lingo?   Or is there a better way?
>
>
>- Rob

on make_RTF themold
  set thecastlib=the activecastlib
  set thesel=the selection of castlib thecastlib
  set subsel=getat(thesel,1)
  set thecount=count(subsel)
  set moldmem=member themold
  copytoclipboard moldmem
  set startmem=getat(subsel,1)
  set endmem=getat(subsel,2)

  repeat with n=startmem to endmem
    set themem=member n of castlib thecastlib
    if the type of themem=#richText then
      set oldtext=the text of  themem
      set oldname=the name of themem
      pasteclipboardinto themem
      set the text of themem=oldtext
      set the name of themem=oldname
    end if
  end repeat
end

-- the above handler is something i have actually used.
you use it like this; create a template rtf member that you giva a unique
name
open the castlib where you have some of your rtf members. select them. (the
handler assumes one continuous selection, would be easy to extend its
capabilities though). from the message window you type "make_rtf  "name of
your template member""

and there you go

you then need to check the rtf members for occasional garbage, residue, e t
c.

good luck
niklas woermann






Dazu:























D. Plänitz