Illustrator Scripting :: Rename Layer Using Name Of Enclosed Object
Feb 17, 2014
I'm trying to build a map of the world that includes provinces and sub-provinces (counties). I will be animating it in AE. AE only sees the top layers so it is imparative that the name of the top layer corresponds the the correct province. Unfortunately all the provinces are not layers. They are objects. I can use the "Release to Layers" command to get all objects nested into top level layers. But the top level layers have generic names (Layer 1, Layer2, Layer 3). The objects nested within these layers have the correct name.
Is there a script that will rename the top level layer using the name given to the object nested within that layer? If not, how to create one?
Here's a link to one of the files: world_all_provinces_Senegal divisions. Level 1_area.zip
View 5 Replies
ADVERTISEMENT
Sep 27, 2012
I create with VBA an Illustrator sheet with custom size:
'define size
Dim B_cust, H_cust As Integer
Set appRef = CreateObject("Illustrator.Application")
B_cust = CInt(InputBox("B=", "Higth:"))
H_cust = CInt(InputBox("H=", "Width:"))
Set newDocument = appRef.Documents.Add(aiDocumentCMYKColor, B_cust, H_cust)
This works fine
I would have fore each new document the same layer order like
cadsymboltext
Rem ###new Layer###
Set myDoc = appRef.ActiveDocument
Set myLayer = myDoc.Layers.Add()
Set myLayer.Name = "cad"
I'm not able to rename the created layer ?
Furthermore I would erase the default Layer LEVEL 1
View 1 Replies
View Related
Dec 20, 2012
rename a layer of illustrator like document file name? (with an action)
View 12 Replies
View Related
Mar 7, 2014
I'm looking to create a script to batch rename a number of artboards.
- I have 100 named layers.
- I have 100 artboards.
- I would like to rename the artboards to match the layer names.
- The layers are organized in the same descending orderas the artboards (ignoring the actual artboard names*).
- The topmost artboard (1 in the list) would be renamed "newspaper", the second artboard would be renamed "typewriter", the third artboard would be renamed "books", etc.
*in the example below the artboard named "Artboard 7" is actually the 6th artboard in list.
View 5 Replies
View Related
Aug 19, 2013
In Illustrator Javascript, you can use the following to rename layers:
var doc = app.activeDocument;
// loop through all layers
for (var i = 0; i < doc.layers.length; i++) {
[Code]....
Is there anyway to rename colour swatches.
For example, I have 20 swatches named Yellow -(Keyword). (The keyword is different for each swatch).
I would like to replace yellow with the word colour1 while replacing the -(keyword) part in tact.
Is this possible? My swatches are in groups, so I am not sure if it makes it more complicated.
View 4 Replies
View Related
Feb 15, 2010
is there a quick way how to renumber or batch rename all layers in a file so they would be named in consequent numbers? Doesn't have to start from exact number, I was wondering if maybe there is some sort of script that would work?
View 24 Replies
View Related
Jun 18, 2013
If I drag an effect from the target circle of one object to anther in the layer's panel it replaces the effect along with all appearance. But I want just to add the effect. For example, a layer has a drop shadow and a path, round corners. I want to move the drop shadow from the layer to the path so that the path now has the round corners and the drop shadow. To do this I have to open the shadow effect of the layer wright down its parameters, then create a shadow effect for the path with the same parameters which is a lot of work.
View 3 Replies
View Related
Jul 25, 2013
I'm trying to write a script that renames a layer, and group within the layer, then an object within the layer (but not a part of the group) and have it run in a loop.
Here's what I've got so far, the group rename doesn't work.
#target Illustrator
var doc = app.activeDocument;
idLayers(doc)//IRename layers
idGroups(doc)//Rename groups
function idLayers(doc){
[code]....
I haven't put in anthing to rename the single object yet since I cant even get the group rename to work. I suspect that the group re-name section isn't working because I'm either using bad syntax or an invalid command.
View 3 Replies
View Related
Aug 16, 2011
How to Raster a object in illustrator with scripting?
View 7 Replies
View Related
Jan 24, 2013
I am trying to add a prototype to the Layers object so I can do something like try{ .getByName(name) catch{ return null. For when the named layer doesn't exist. (It gives an error for me in CS5). So unfortunately me trying to go Layers.prototype. my method doesn't seem to work at all.
View 3 Replies
View Related
Oct 4, 2012
is there a way to get position of any selected object? It seems like normally you have to dive into specific item like textFrames to get position, but was curious if there was a generic way of doing this for selected objects.
View 5 Replies
View Related
Mar 17, 2013
Is there any way to move a object using its width? ex: "move to left a box with 10cm(width) using this value (10cm)". But I want to capture the width of any selected object.
Another thing: i want to select objects with same fillcolor and do something like: pathfinder>>add;
View 9 Replies
View Related
Oct 3, 2012
Can this be done in illustrator scripting??
[URL]
creating a rectangle around selected object or objects and set margins...
View 8 Replies
View Related
Apr 26, 2012
Trying to see what the properties of an object are so I wrote a function, doesn't seem to work though. it is definitely an object though.
alert(typeof selection); //returns object
function printType(obj) {
var key;
for(key in obj) {
if(obj.hasOwnProperty(key)) {
[Code] ......
View 7 Replies
View Related
Aug 9, 2013
i want to select all the object , but i locked certain object it show error while submiting below code
myDoc = app.activeDocument;
myPageItems = myDoc.pageItems;
for (i=0;i<myPageItems.length;i++)
{
myPageItems[i].selected = true;
}
modify above code to select all objects except locked object or i want to select objects outside active artboard
View 4 Replies
View Related
Apr 3, 2012
I am writing my own Illustrator scripts.
How do I write a script to delete layer with ".ARD" name.
View 8 Replies
View Related
Sep 8, 2012
I am new to scripting in Illustrator.I am trying to import PSD files into an AI layer.So far this is my solution.
var TRGdoc = app.documents.add(DocumentColorSpace.RGB, "1920", "1080");
var onFile = File( '~/Desktop/jpeger/illDanceREFon_00642.psd' );
var REFon = app.open(onFile);
var LAYon = REFon.layers[0];
var LAYstuffon = LAYon.pageItems[0];
LAYstuffon.selected = true;
app.copy();
TRGdoc.activate();
var TRGlayer = TRGdoc.layers[0];
TRGlayer.selected = true;
app.paste();
It works most of the time but sometimes it hangs up on the paste.
View 4 Replies
View Related
Feb 20, 2013
Is there a way to determine which object in a selection is the key object? For example: draw 10 squares on a layer, select all of them, click on one of the 10 and it becomes the Key Object (heavy border) for things like Distribute Spacing on the Align pallete. I can determine that a particular object is selected via ActiveDocument.Selection.PathItem[n].Selected = true/false. But I can't figure out how to find out if this is the KeyObject. The ultimate goal is to modify the below script so that it uses the KeyObject as the reference and not the object on the bottom-most layer.
Here is the Script - from [URL]
mySelection = activeDocument.selection;
if (mySelection.length>0){
if (mySelection instanceof Array) {
[Code]....
View 3 Replies
View Related
Jan 24, 2012
trying to make an object the exact size of the artboard. This is something I do on a daily basis for several different reasons and it would be very useful if this can happen automatically for whatever size the artboard may be. As I understand it the only way is with a script but I have no experience with making illustrator scripts, im definately no programmer. I have set up quickkeys in the past to copy from the artboard inputs when you are on the artboard tool but these round to the nearest .01 and this is not accurate enough for what I am working with. Also if I do this with multiple pages open illustrator is very slow to respond to the artboard tool.
Below is a script that I saw on here that I believe may contain what I need but now knowing programming. Where to start on editing. All I need is the part where an object is placed on the artboard that is the exact same size as the artboard.
#target illustrator function main() { if (app.documents.length == 0) { alert('Open a document before running this script'); return; // Stop script here no doc open… } else { var docRef = app.activeDocument; with (docRef) { if (selection.length == 0)
[Code].....
View 23 Replies
View Related
Feb 23, 2012
I'd like to select an object and have a script select all objects behind that object, within that objects bounds. I believe this is possible with z-order? But I've never worked with Z-orders before
View 5 Replies
View Related
May 30, 2013
When I run the script for an object selection, I want each object to have its color set to the underlying color as if I had used the eyedropper tool. Is this something that can be scripted?
View 1 Replies
View Related
Feb 21, 2014
Is there a way to simply select all object directly below an objects?
I found this script here but it doesn't seem to work.
//DESCRIPTION:Select Below
// A Jongware Script
if (app.documents.length && app.selection.length)
{
ypos = app.selection[0].visibleBounds[3];
[Code] .....
Here's an example file. I'm trying to select eveything below the yellow polygon.
This would be very useful in another project with many small objects bunch together below many larger objects. I want to group the small objects that are bellow the larger object together without having to manually select each objects (there are thousands of objects so a script would be ideal).
View 1 Replies
View Related
Oct 28, 2009
In prior versions of illustrator we used a script that basically saved the visible bounds of a masked object as an EPS file. With the upgrade to CS4 and Multiple Artboards this save function (EPSSaveOptions) no longer does the same visible bounds. I have read several post of similar issues, but what I am asking is:
In there a way to make the visible bounds of the eps file equal the artboard on the active artboard only? The artboard seems to be driving the crop box. When I manually save the file as EPS the visible bounds are correct. When I save from the script it is not? As with other posts I do not want to go backwards within compatibility...I would like to keep the file at the CS4 level. What command am I missing? We have tried making the crop box = visibleBounds to no avail.
View 5 Replies
View Related
Dec 19, 2012
Is it possible to script using a highlighted layer.
I know that selected items can be used for scripting, but I would like to just highlight the layers I want to process but not directly select the items on those layers.
View 2 Replies
View Related
Jan 3, 2013
what is the script to delete some letters from layer?For ex. I've "Layer XYZ" and I want "Layer XY".
View 9 Replies
View Related
Mar 3, 2013
How to make a layer visible by using the name of the layer, with javascript?
View 2 Replies
View Related
Dec 19, 2012
I am working on a script to standardize layers and I need to move all the pageItems from a layer called "PART_NUMBER" to a layer named "STATIC".
following code at the arrow...
I am using "test" to troubleshoot the move.
standardizeLayerNames() // This function verifies that the Layer names conform to the standard Layer names.
function standardizeLayerNames() {
var myDoc7=app.activeDocument
var myLayerCount7 = myDoc7.layers.length
[Code] ........
View 4 Replies
View Related
Jun 28, 2013
I've got a script that creates a palette that does some calculations when a button is pressed - but something in the script is failing silently. (this question is about how to debug things like this, not what the problem is in my specific script)
I've read the debugging tips in the Javascript tools guide, and based on that, re-opened the script in the Extendscript Toolkit instead of my usual text editor, chosen Illustrator, and hit the green 'Go' button. But, either I've missed something fundamental, or this isn't designed for palettes - the script runs in Illustrator, successfully pops up the palette, considers the job done, pats itself on the back, and closes the palette before I can begin debugging the button.
I'm looking for something where I can test the palette doing regular Illustrator work and see debug messages, set breakpoints, etc. I've tried the old-school approach of just filling the code with 'alert("blah")'s but it doesn't work - my code reaches an
" if(app.activeDocument.selection.length){ alert(1);} else {alert(2);} "
and doesn't alert either of them, or give any error message.
If I was working in a browser, I'd just plonk in a "console.log( app.activeDocument.selection )" and browse the object structure to see what's going on, is there any Illustrator equivalent?
View 1 Replies
View Related
Nov 26, 2012
I need the finished script to create a rectangle with no fill and a 20% gray stroke to outline each artboard. I dug this up off these boards, which works perfectly except the rectangles created have no fill or stroke. certainly save me a lot of time drawing rectangles on a daily basis.
#target illustrator
var docRef = app.activeDocument;
var artboardRef = docRef.artboards;
for(i=0;i<artboardRef.length;i++){
var top=artboardRef[i].artboardRect[1] ;
var left=artboardRef[i].artboardRect[0];
var width=artboardRef[i].artboardRect[2]-artboardRef[i].artboardRect[0];
var height=artboardRef[i].artboardRect[1]-artboardRef[i].artboardRect[3];
var rect = docRef.pathItems.rectangle (top, left, width, height);
rect.fillColor = rect.strokeColor = new NoColor();
}
View 3 Replies
View Related
Jan 4, 2013
I am realtively good with actionscript, so I am trying my hand at this to streamline our image exporting process. I am using CS5 on a PC.
We build our illustrator files to be a combination of different layers. Sometimes just one layer is exported at a time, and sometimes layers are combined to form a more complex image. We use layer names with instructions of what layers should be on and off.
An example of the layer naming might look like this:
03 (01-ON, 02-OFF)
02 (01-OFF)
01
I have been able to figure out how to check if there is a note to turn a layer on, my question is how do I select the layer to turn on the visibility without using the exact name of the layer?
In my example, when layer 3 gets exported, it should have layer "01" visible and layer "02 (01-OFF)" not visible. Since our files are always constructed differently (meaning 02 might not always have a note about 01 being off), I can't use the getByName option because I don't have an exact name to call the layer and turn the visibility on. The layers always start with 01, 02, 03, etc. Is there a way to use getByName and only have it look at the first 2 characters of the layer name?
View 8 Replies
View Related
Dec 27, 2010
Is there a simple way to test whether a layer with a specific name exists?
View 9 Replies
View Related