no can do with actions, you'll have to use a script
Ok, but what script????
var idoc = app.activeDocument; var ilayer = idoc.activeLayer; var filename = idoc.name; ilayer.name = filename;
but Illustrator says:
Error 8: Syntax error.
I saved your script like a *.jsx
how did you save it? please elaborate
what does cocoa have to do with this?
But you didn't force it to plain text. It's a Rich Text File from the error message.
Sorry for my english and sorry for my basic level of scripting.
I copyed your code in textedit and saved as layer.jsx.
Then I put it in the illustrator library, together with other scripts; then I call the script from illustrator (with a open document) to see if it'd change layer name (as the document), but Illustrator gave me that error.
I understand where was my mystake!
so...it works now?
thanks for helping Larry
You can't rename an existing layer with an Action, but you can create a new layer with a specific name, and the name will be recorded.
Therefore, you can make an action that does the following:
(Start on the layer to be renamed)
Lock other layers
Delete current layer
Make new layer with desired name
Paste in place
Unlock all layers
Due to a bug in CS6, you can't put the new layer in the same place using the "New layer behind" keyboard shortcut. The new layer is always at the top.
Hope this helps.
This works great!
Is there a way to make it just grab the document name, but not the file extension. Right now if my file is "abc.ai", it renames the layer "abc.ai". I'd like it to just be "abc". If you know how I would appreciate the help. Thanks!
Is there a way to make it just grab the document name, but not the file extension.
Many options via JS:
slice, split, replace, substr, match, regex, etc...
If anyone else is interested in jdutle's inquiry above, they made a new thread on the topic: