Page 1 of 1

Count the number of lines in stack

Posted: Wed Apr 20, 2016 11:59 am
by kevin007
Hi All,

I have lots of lines in my stack I want count the number of lines in stack, is it possible ?

Thanks
Kevin

Re: Count the number of lines in stack

Posted: Wed Apr 20, 2016 12:20 pm
by Klaus
Hi Kevin,

what kind of "lines"?
Lines of code?
Line graphics?
Lines of coke?
:D


Best

Klaus

Re: Count the number of lines in stack

Posted: Wed Apr 20, 2016 12:24 pm
by kevin007
Hi, :)

I means that Line graphics

Thanks
kevin

Re: Count the number of lines in stack

Posted: Wed Apr 20, 2016 1:04 pm
by Klaus
Hi Kevin,

aha! :D

OK, for this you will need some repeat loops:
1. through all cards in your stack
2. through all graphics on ecah card and there you need to
3. check if the style of a graphic = "line"

Something like this:

Code: Select all

on mouseUp
   ## We collect the number of LINE graphics in this variable:
   put empty into TotalNumOfLines
   repeat with i = 1 to the num of cds
      put the num of grcs of cd i into tNumOfGrcs
      repeat with g = 1 to tNumOfGrcs
         if the style of grc g of cd i = "line" then
            add 1 to TotalNumOfLines
         end if
      end repeat
   end repeat
   answer "You have" && TotalNumOfLines && "line graphics in your stack."
end mouseUp
Tested and works!

Did you already check these stacks? Great learning resources for the basics of LC:
http://www.hyperactivesw.com/revscriptc ... ences.html


Best

Klaus

Re: Count the number of lines in stack

Posted: Wed Apr 20, 2016 3:47 pm
by dunbarx
Hmmm.

What Klaus may have said.

But did you mean than you have polyLines, and want to count the number of segments in those graphics?

Craig Newman