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

Name and Number selected paths?

Explorer ,
Jan 10, 2011 Jan 10, 2011

I am working on a very large .ai file of a baseball stadium render. It contains many small sections and box seats that need named and numbered in this format: section::100, section::101, ... and so on. Right now, I'm having to go through and rename each path individually. Is there a script that will save me TONS of time by automating this for me?

I found this one on here, which is a good start for what I need, but it doesn't let me only number selected paths, nor does it let me start the numbering where I want (say at 100 and go up from there).

#target illustrator

var docRef = app.activeDocument;
var newName = prompt ("What's the base of the new name","base");
var myNB = docRef.pathItems.length;
for ( i = 1 ; i < myNB; i++)
{
var finalName = newName + i;
docRef.pathItems.name = finalName
}

Thanks in advance!!

TOPICS
Scripting
1.2K
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

correct answers 1 Correct answer

Guide , Jan 10, 2011 Jan 10, 2011

I have taken a quick guess at what you want but Im supposed to be busy at work…

#target illustrator var docRef = app.activeDocument; var newName = prompt ("What's the base of the new name","base"); var stNumb = prompt ("What's the start number","1"); var myNB = docRef.selection.length; for (var i = 0 ; i < myNB; i++) {      var finalName = newName + stNumb;      if (docRef.selection.typename == 'PathItem') {           docRef.selection.name = finalName;           stNumb++;      } }

Translate
Adobe
Guide ,
Jan 10, 2011 Jan 10, 2011

Im not convinced that a script is going to work for what you want to do… You can work with selected objects and check that they are 'text frames' you can also prompt for a start number and check it's a number before using it. Where you 'may' fall into difficulty is with the stacking order of the objects within the drawing. Your sample script will number in this order as is…

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
Explorer ,
Jan 10, 2011 Jan 10, 2011

Thanks for the reply Mark, but you may be misunderstanding one aspect.. I don't need to rename/edit text boxes. I make a separate layer called "labels" and manually change each one. I can deal with that, if I have to. I'm talking about renaming and numbering paths. Here's a screen of what I'm dealing with...screen.jpg

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
Explorer ,
Jan 10, 2011 Jan 10, 2011

... or, I could could refer to them as path layers... I need the names of the path layers to be named and numbered. Remember, the script I posted above mostly works for what I need it to do, it just simplay renames every path in the document (I need selected paths only), and starts the numbering at 0 (I need to start the numbering at the number I choose).

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 ,
Jan 10, 2011 Jan 10, 2011

I have taken a quick guess at what you want but Im supposed to be busy at work…

#target illustrator var docRef = app.activeDocument; var newName = prompt ("What's the base of the new name","base"); var stNumb = prompt ("What's the start number","1"); var myNB = docRef.selection.length; for (var i = 0 ; i < myNB; i++) {      var finalName = newName + stNumb;      if (docRef.selection.typename == 'PathItem') {           docRef.selection.name = finalName;           stNumb++;      } }

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
Explorer ,
Jan 10, 2011 Jan 10, 2011

You my friend, are a lifesaver!! This is perfect!

Sorry to keep you from your work, but you have made my work MUCH easier.

Thanks so much!

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 ,
Jan 10, 2011 Jan 10, 2011

My boss has no idea as to what I can/can't script… So I can make it work for me… Glad it works… I did think you were putting in the labels…

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
Explorer ,
Jan 10, 2011 Jan 10, 2011

Haha.. hopefully you can use it yourself. Hey a quick, dumb question I hope you don't mind answering in this thread... Is there a way to quickly select/target paths within the layers pallete?.. I can Shift+click, but it makes me do it one path at a time. No big deal, but would be a little faster if there was a way.

Then I'll leave you alone, promise

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 ,
Jan 10, 2011 Jan 10, 2011

Click inside the 'circle' of your layer 'sections' in the layers pallete? Should select all sub items…

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 Expert ,
Jan 10, 2011 Jan 10, 2011
LATEST

.. Im supposed to be busy at work…

hahahaha...good one

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