// Script function: Count the number of lines on the front-most displayed image

// Unless named starting with GlobalSino, EM, My, Self, the function commands are defined 
//by Gatan DM, please see at link: http://www.globalsino.com/EM/page2597.html

Image GlobalSinoImage:=getfrontimage()
Imagedisplay EMimage=GlobalSinoImage.Imagegetimagedisplay(0)

number EMlines=EMimage.Componentcountchildrenoftype(2) 
//Type 2: solid lines (not an arrow, dotted line etc)

Result("Number of lines is "+EMlines +"\n")
Showalert("Number of lines is "+EMlines+" ", 2)