ah - fun with repeat loops!

At 4:55 PM +0100 11/2/05, you wrote:
about how many lines of code they wrote

on countLines

Since you're timing it, I'd improve the performance when including blank lines & add a param that lets you make that decision without re-editing the code.

change the above to

 on countLines skipBlanks

  nrLines = 0
  nrScripts = 0
  nMems = 0
  nC=_movie.castlib.count
  t=_system.milliseconds
  repeat with n=1 to nC
    nMembers=_movie.castlib[n].member.count
    nMems=nMems+nMembers
    repeat with o=1 to nMembers
      if _movie.castlib[n].member[o].type=#script then
        nrScripts = nrScripts + 1
        lCount=_movie.castlib[n].member[o].script.text.line.count

        -- to include blank lines, pass in skipBlanks = 1
        if skipBlanks then
nrLines = nrLines + _movie.castlib[n].member[o].script.text.line.count
        else

        repeat with m=1 to lCount

-- comment this IF statement out if you want to count emtpy lines as well
          if _movie.castlib[n].member[o].script.text.line[m]<>"" then

            nrLines=nrLines+1

            -- and if you comment it out, don't forget thisone as  well... :)
          end if
        end repeat

        end if

      end if
    end repeat
  end repeat
  t=( _system.milliseconds-t )/1000.0000
return "Counted "&nrLines&" lines of code in "&nrScripts&" scripts. Searched "&nC&" casts, containing "&nMems&" castmembers in total. Search took "&t&" seconds to complete."
end

-Buzz

[To remove yourself from this list, or to change to digest mode, go to 
http://www.penworks.com/lingo-l.cgi  To post messages to the list, email 
lingo-l@penworks.com  (Problems, email [EMAIL PROTECTED]). Lingo-L is for 
learning and helping with programming Lingo.  Thanks!]

Reply via email to