Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Extracting unique identifier for illustrator layers

Community Beginner ,
Jun 03, 2014 Jun 03, 2014

Hi All,

Multiple layers in an illustrator file can have the same name. So the layer name cannot be a unique identifier for layers. Is there a way to extract a unique identifier for layers through scripting? I saw that if the 'Identify Objects by' property (inside Preferences -> Units) is set to XML ID, all layer names, even identical ones are replaced by some unique ids. Can we extract these ids via scripting without manually changing the 'Identify Objects by' property. Basically, extraction of any unique identifier for illustrator layers would serve the purpose. I am really stuck with this and need help urgently. Any help would be highly appreciated.

Thanks in advance.

TOPICS
Scripting
2.5K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
New Here ,
Oct 29, 2014 Oct 29, 2014

Hi I have just asked this same question Access XML_ID of pageItem/groupItem before seeing this one.

Did you ever find a solution?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 29, 2014 Oct 29, 2014

Hi Michael,

Unfortunately I never got the solution as to how we can access the XML ID. I resorted to generating by own id for the layers. It is not exactly an ideal solution but suffices my purpose. Though I would love to know if at all there is a way to extract the unique id .

Thanks.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Nov 02, 2014 Nov 02, 2014

Not sure if this is what your after, but under Preferences there is an option to "Identify Objects By: Object Name or XML ID"

I only just noticed it so not sure if it helps in any way

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 03, 2014 Nov 03, 2014

Hello,

I was actually trying to access this unique id using Extendscript. That's where I was stuck as I could not find which property in the Illustrator DOM would give me the value for XML ID.


Thanks.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Nov 04, 2014 Nov 04, 2014

Hi all, I am sorry to bring about gloom, but it is my opinion that the (Identify by Object Name or XML_ID) is purely for input purposes while you're using Illustrator to draw.  The preference controls how you can input new names (Unique name, no spaces, no start with number, etc) and makes changes to existing names to convert to the new preference.  The name is now in the format of an XML_ID, so your pageItem.name is still what reflects the object's xml id.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Nov 04, 2014 Nov 04, 2014
LATEST

When I found this I noticed it changed the name of the layers in the layers pallet.

I had not had a chance to test this with code.

If "use XML ID" is turned on then you are not able to name layers the same thing.

this in turn would follow through to your script using layer.name

for existing files you would need to fix names manually or...

I am sure it would be possible to Script.

eg. export SVG file and pull the layer ID's from that and rename the document layers accordingly. (may be a little tricky for sublayers, but top level layers should be straight forward)

Then as long as "use XML ID" is left on the files would not need this run again as you cannot use duplicate layer names.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines