I am new to skill, I would like to search for all the labels in a layout and print them in a file. I dont want to traverse through the hierarchy. Is there a skill function to do that or if not can you please provide a small code snippet to do the same.
Here is a small code snippet, I am trying to run
myPort = outfile("/home/vvangap/tmp/printLabels.txt")
/****Operating on the desired property****/
if(shape~>objType == "label" then
fprintf(myPort "\n Label: %L" shape)
)/****end of if****/
)/****end of foreach****/
;;)/****end of let****/
)/****end of procedure****/
The above code prints the database numbers in the CIW window, but I need the labels itself to be printed in the printLabels.txt file.
Just use shape~>theLabel in your fprintf - this is the text of the label itself.
Thanks Andrew it works,
In the above script, is there a way to find the coordinate location of a label?
It's not my code, but you could use shape~>xy to find the coordinate (origin) of the label.