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

Getting empty string in 'name' property of pathItem.

Participant ,
Mar 16, 2017 Mar 16, 2017

Copy link to clipboard

Copied

Hi All,

I created some pathitems on an artboard and by default it's name set to "<Rectangle>", "<Polygon>", <Ellipse> etc. (Whichever tool used by default that name assigned) . I am selecting any of the pathItem and trying to get it's name using app.selection[0].name. But I am getting empty string instead of the default name.

Is there any way we could get that?

Thanks for any help!

TOPICS
Scripting

Views

385

Translate

Translate

Report

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
Valorous Hero ,
Mar 16, 2017 Mar 16, 2017

Copy link to clipboard

Copied

the name property doesn't account of the 'preview name', or the text that is by default show inside the layers panel. The way to have this property filled is to either manually or by script, change the name in the layers panel. Items like <Group> and all above you mentioned are by default un-named. Same thing with text frames, they may show the text frames' text in the layers panel as a preview, but that is not the name of the text frame, not until you name it explicitly. One more caution note: if you are using the UI only and you may have one day a situation where you want to name an art object the same as it's preview name - it is not going to work. If you for example wanted to have your rectangle's name *really* be "<Rectangle>", you cannot just type that in over the preview name of the same text, because it will just think there were no changes made to the name and it will ignore such changes. What you'd have to do, if using UI, is to first name your rectangle any dummy name, initially. Then after this dummy name has been set, you can type in <Rectangle> and it will be set. This isn't an issue when setting it via script though.

If I had to guess, you're wanting to determine the kind of shape there is in your document? That would be a good question, if there is any way to determine those without having to do math, or in fact if it's possible to distinguish between regular paths and Illustrator shape paths..

Votes

Translate

Translate

Report

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
Participant ,
Mar 17, 2017 Mar 17, 2017

Copy link to clipboard

Copied

LATEST

Thanks Silly-V, Yes I noticed that naming it via script or manually worked.

If I had to guess, you're wanting to determine the kind of shape there is in your document?

Yes, as name comes out empty so may be if there is some work around for path items to know its type rather than just pathitem (that we get from typename).
With text item, we have its contents so not a problem. But with shape, if we could get more precise than just pathitem that would be great.

Votes

Translate

Translate

Report

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