Working with grouped text

Jan Decroos jan.decroos at groepvanroey.be
Fri Sep 26 06:02:01 EDT 2003


Maybe, next script can help: it parses the htmltext of the field : we find
links in the htmlText by searching for  '<a> ... </a>'.  Then we look if this
link is underlined too ('<u>' before '<a>', and '</u>' after '</a>')

It needs a btn (script), and a field (data)

put next handler in the btn's script:

on mouseUp
  -- <u><a> ... </a></u>
  put the htmltext of field 1 into lHTMLText
  put "" into lUnderlined
  put 0 into lCurrentGroup
  put 0 into lStartPos
  put 0 into lPrevStartPos
  repeat
    put offset("<a>", lHTMLText, lPrevStartPos) into lStartPos
    if lStartPos = 0 then exit repeat
    put offset("</a>", lHTMLText, lPrevStartPos) into lEndPos
    if lEndPos = 0 then exit repeat
    add 1 to lCurrentGroup
    if (char lPrevStartPos+lStartPos-3 to lPrevStartPos+lStartPos-1 of
lHTMLText = "<u>") and\
       (char lPrevStartPos+lEndPos+4 to lPrevStartPos+lEndPos+7 of lHTMLText =
"</u>") then
            put lCurrentGroup&comma after lUnderlined
    end if
    add lEndPos+4 to lPrevStartPos
  end repeat
  if last char of lUnderlined = comma then delete last char of lUnderlined
  answer lUnderlined
end mouseUp



Regards,
Jan




More information about the use-livecode mailing list