Anyone have ideas on how to speed up MC's script colorizing?

Here's the handler from the card script of the Script Editor stack:


on colorizescript
  if tokencolors["if"] is empty then setupcolors
  local s
  put field "Editor Field" into s
  put s into field "Editor Field"
  go to card 2
  local curword
  put 1 into curword
  repeat for each word w in s
    if tokencolors[w] is not empty
then set the textColor of word curword of field "Editor Field" of card 1 to tokencolors[w]
    add 1 to curword
  end repeat
  local oldline, cline, curline, nwords
  put min(lineoffset("#", s), lineoffset("--", s)) into oldline
  put 0 into cline
  repeat while oldline is not 0
    add oldline to cline
    put line cline of s into curline
    put the number of words in curline into nwords
    repeat with curword = 1 to nwords
if char 1 of word curword of curline is "#" or char 1 to 2 of word curword of curline is "--" then set the textColor of word curword to nwords of line cline of field "Editor Field" of card 1 to "DarkOrchid4"
        exit repeat
      end if
    end repeat
put min(lineoffset("#", s, cline), lineoffset("--", s, cline)) into oldline
  end repeat
  go to card 1
  unlock screen
end colorizescript


On short scripts it's fine, but run it on lengthy ones like libURL and it takes some time.

Any suggestions welcome...

--
 Richard Gaskin
 Fourth World Media Corporation
 ___________________________________________________________
 [EMAIL PROTECTED]       http://www.FourthWorld.com
_______________________________________________
metacard mailing list
metacard@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/metacard

Reply via email to