Copy link to clipboard
Copied
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!!
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++; } }
Copy link to clipboard
Copied
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…
Copy link to clipboard
Copied
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...
Copy link to clipboard
Copied
... 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).
Copy link to clipboard
Copied
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++; } }
Copy link to clipboard
Copied
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!
Copy link to clipboard
Copied
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…
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Click inside the 'circle' of your layer 'sections' in the layers pallete? Should select all sub items…
Copy link to clipboard
Copied
.. Im supposed to be busy at work…
hahahaha...good one
Find more inspiration, events, and resources on the new Adobe Community
Explore Now