Illustrator Scripting :: Delete Some Text From Layer
Jan 3, 2013what is the script to delete some letters from layer?For ex. I've "Layer XYZ" and I want "Layer XY".
View 9 Replieswhat is the script to delete some letters from layer?For ex. I've "Layer XYZ" and I want "Layer XY".
View 9 RepliesI am writing my own Illustrator scripts.
How do I write a script to delete layer with ".ARD" name.
When running my script to unlock all layers, so I can select all textFrames and copy them to a new layer, I run into a problem with text that has been locked individually. The script unlocks layers that are lock but it does not unlock items that have been locked individually on those layers. Is there a way to unlock these items?
var layerCount = activeDocument.layers;
for ( j = layerCount.length - 1; j >= 0; j-- )
{
lockedLayers = activeDocument.layers[j];
if (lockedLayers.locked == true && lockedLayers.visible == true)
{
lockedLayers.locked = false;
}
}
Okay my script to change text frame color changes the color of all text frames hidden or not.
I need it to only change visible text frames.
if ( app.documents.length > 0 ) {
newCMYKColor = new CMYKColor();
newCMYKColor.black = 0;
newCMYKColor.cyan = 0;
newCMYKColor.magenta = 0;
newCMYKColor.yellow = 0;
[Code]...
How to go about making it only change the color of text frames on the active layer? In the final script I will hide all other layers so if it could be done by a visible attribute more easily that would work just as well.
the Script of creating mirror text and stroke text in Adobe illustrator scripting.
View 4 Replies View RelatedI want to delete an Image File using JSX .
I explored the functions in File but there is nothing like Delete().
Any success creating a script that delete elements in Illustrator by its colors?
For example, I want to delete all elements that is colored Red in a document regardless what layer or artboard thay are in.
I am trying to create a script to specify a percentage of the selected items you want to remove.Here is what I have so far.
I still need to work out on the alert prompt and the if statement, but for now, I have the feeling that the selection.length keep changing each time Illustrator delete an object, and I don't know how to make it stick.
var selection = app.activeDocument.selection;
//alert prompt dialog for a percentage of deletion
for (var i = 0; i < selection.length; i++) {
if (Math.random < 0.5) { //need to work out the percentage
alert("yes")
selection[i].remove();
}
}
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.
I've just recently learned how to use scripts to my advantage. I work for a company that uses a lot of custom details using AutoCAD and have now decided to switch them up and use different layers, fonts & styles. So far I have been able to come up with some script changing the styles of how we want the fonts to look, but I am trying to select one font style, change the layer & color of that text, then close the file.
View 4 Replies View RelatedI 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.
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.
How to make a layer visible by using the name of the layer, with javascript?
View 2 Replies View RelatedI 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] ........
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
I am working on a project which needs..Text frames to be converted as flash text >property changed to dynamic text > writing instance name “_txt”.so how can i write scripting on above process.
View 5 Replies View RelatedI 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?
Is there a simple way to test whether a layer with a specific name exists?
View 9 Replies View RelatedI'm new in scripting and i need to make a script that moving all layers into a single layer (in Illustrator i press CTRL+A then CTRL+G in layers and works) but i need that in script.
View 2 Replies View RelatedI would like to make the active layer name the same as the document name. I know very little about scripting. I found this script:
var idoc = app.activeDocument;var ilayer = idoc.activeLayer;var filename = idoc.name;ilayer.name = filename;
It does almost what I need it to do. except that it also copies the ".ai" in to the layer name. Is there some way to modify this script to have it exclude or delete the file extension?
I am trying to iterate through objects in a layer and if the object satisfy a condition, I want to remove it.
Problem is that from what I suspect, if I use a "for loop" then when I remove an element, the initial length of the loop becomes invalid by removing the element. So what I would need is to iterate through objects in another matter and I am clueless.
Is there a way to assign one of the default layer colors with javascript? like light blue, light red, or green.
View 3 Replies View RelatedI have a PDF file with 25 pages that I need to get into the form of an Illustrator file with 25 layers. I found the example of opening a particular page of a PDF file (using CS6), and that works. And I can create layers. But I can't figure out how to place a particular page of a PDF file into the new layer. Where/how do I provide the page info?
(I have a PostScript program that generates artwork for signs that are to be laser etched at the TechShop. The laser interface uses Illustrator and a special Print driver. I notice that opening a page from a PDF file positions the contents slightly differently than placing that page, when I do it manually, so I figured I'd create the multilayered Illustrator file by opening one page (which works) then placing all the pages in their own layers, then deleting the first page. Then the positioning will be consistent. But I'm stuck at placing a PDF page...)
tell application "Adobe Illustrator" to activate
-- This function opens the file passed as
-- a file reference parameter, at page myPage.
-- fileToOpen is a reference to a multi-page PDF file
-- and needs to be set up before calling this function.
on openMultipageFile(fileToOpen, myPage)
tell application "Adobe Illustrator"
set user interaction level to never interact
[Code].....
rename a layer of illustrator like document file name? (with an action)
View 12 Replies View RelatedI'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
Are there any scripts to find and replace layer names?
There is an excellent script available for Photoshop which allows you to not only replace words in layer names, but also insert words as Prefixes, Suffixes and Sequential Numbers. The illustrator version of this script only allows sequential numbering: It doesn't offer find and replacing of words.
Ideally, it would be great if there was something that could do multiple find and replaces in one go:
(E.g.
You have layers like this Car, Dog, Bat
You enter: car(Option1), dog(Option2), Bat(Option3)
Your layers then become: Option1, Option2, Option3).
)
How to create a single symbol from all the objects within a single layer.
Despite what the reference docs say, it doesn't seem that PageItems is a valid argument to pass into Symbols.add()...
Some example code?
I recently created a script that reads the layer names of an Illustrator file, and uses the name to identify a swatch to use to pattern all elements on that specified layer. The script works well, and is a real time saver for our mapping staff, but it requires duplicate swatches to exist, where the only difference is their colour.
To improve the script I want to duplicate a swatch and modify its' colour before applying it to a specific layer. I think the only way this can be done is via the "placedItems" command. So the code I'm trying to write looks likke this:
for(var s=0; s<slib.length; s++){ // search swatch library
var pat=slib[s].name; // get swatch name
[Code]...
However I'm struggling to find the correct syntax to make this work.
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.
I have a script that measures the repeat interval and gap between print impressions printed using a print cylinder (for the production team to know which print cylinders to use, and what to expect once it prints, when looking at the proof sheet). Basically it just measures the distance from the beginning of one print impression to the beginning of the next (these are printed with a cylinder, so every time the cylinder rotates a new print impression happens) as well as the distance in between prints. That part works great.
In order to get these meaurements, Illustrator is measuring the distance from a zero point on the artboard to the left side of a marker I made called "repeat", and it is assigned a variable called rawRepeat. What I'd like to do is have the script take that rawRepeat value and use it to move a copy of the print impression to the right by exactly that variable amount and paste it beneath the marker called "repeat". I have been doing this part manually, but haven't been able to figure out how to get illustrator to do this for me.
Here's the script I am using:
var myDocument = app.activeDocument;
var selectedObject = myDocument.selection;
var activeLayer = app.activeDocument.activeLayer;
var layerName = activeLayer.name;
activeLayer.name = "plate";
[Code] .....
I am trying to grab specific spot colors and move them to separate layers for our cutting software. In this case I am trying to grab "perimeter cut" and move it to a layer called "tc 1" I get the following error when I try to run the script.
#target Illustrator
var idoc = app.activeDocument;
var ipath = idoc.pathItems;
if (ipath.typename == "SpotColor") {
if (ipath.spot.name == "perimeter cut") {
ipath.move(tc 1, ElementPlacement.PLACEATBEGINNING).
}
}