Quantcast
Channel: Adobe Community : Popular Discussions - Illustrator Scripting
Viewing all articles
Browse latest Browse all 12845

How do I batch-rename objects/paths (not just layers)?

$
0
0

Question from a complete n00b:

 

I need to rename a large number of selected objects/paths. This is because I want to use another script that only works when my objects have the default name, "<Path>". So really, I just need to remove existing names of objects.

This other script is here:

http://kelsocartography.com/blog/?p=325

 

Of course, I could manually remove names by double-clicking on objects in the layers palette and deleting the name, but that's no fun.

 

I've found some great scripts for renaming layers, but nothing for non-layer objects.

 

First, I'm trying to remove names from ALL objects in the document.  once that's working, I want to only remove names of selected objects.

 

Here's my very simple non-working javascript - (the whole thing):

 

app.activeDocument.pageItem.name = "";

 

my test Ai file is also really basic: a few rectangles, some of which have been named in the layers palette.

 

When I run this, I get:

Error 21: undefined is not and object.

Line: 1

->     app.activeDocument.pageItem.name = "";

 

I've tried a number of other approaches, and either get "undefined is not an object" or nothing happens. 

 

pageItem has "name" as a writable property, so I think it's what to use, but I really don't know what I'm doing - help!

I'd also happy to use actions, but I'm stuck on that too.


Viewing all articles
Browse latest Browse all 12845

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>