Skip to main content
Inspiring
November 27, 2011
Answered

Selecting Symbols on page by name

  • November 27, 2011
  • 15 replies
  • 3696 views

Im struggling with the correct use of symbol / symbol items in applescript. I can successfully list the symbols used on the page, but I cannot select them. Any suggestions on how I can select all the items on the page that are Symbol Items of symbols named "Apples" but not oranges? After that I hope to replace the instances matching the height or width of the items whichever is greater with a 3rd item name. Any suggestions would be great. Javascript is always an option as well but I had the same difficulty.

This topic is closed to new replies. Start a new post to keep the conversation going.
Correct answer CarlosCanto

here's how to do it with JS

var idoc = app.activeDocument; // get active document

for (i=0; i<idoc.symbolItems.length; i++) // loop thru all symbol items in the active document

          {

                    var symbolitem = idoc.symbolItems; // get each symbol item

                    if (symbolitem.symbol.name == "Apples") // check if it is an instance of "Apples" symbol

                              {

                                        symbolitem.selected = true; // if it is, then select it

                              }

          }

15 replies

CarlosCanto
Community Expert
CarlosCantoCommunity ExpertCorrect answer
Community Expert
November 27, 2011

here's how to do it with JS

var idoc = app.activeDocument; // get active document

for (i=0; i<idoc.symbolItems.length; i++) // loop thru all symbol items in the active document

          {

                    var symbolitem = idoc.symbolItems; // get each symbol item

                    if (symbolitem.symbol.name == "Apples") // check if it is an instance of "Apples" symbol

                              {

                                        symbolitem.selected = true; // if it is, then select it

                              }

          }

mcs_deanAuthor
Inspiring
November 27, 2011

Thanks much. I was going in circles. Works like a charm.