Illustrator Scripting :: CS5 - Action Or Script To Move Selection To Specified Layer?
May 17, 2013
I have a piece of art on "Layer 1" that i need to shrink and duplicate to "Layer 2". The two layers are always named the same. I'm working in CS5.
View 6 Replies
ADVERTISEMENT
Dec 20, 2012
rename a layer of illustrator like document file name? (with an action)
View 12 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
Nov 12, 2013
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] .....
View 11 Replies
View Related
Oct 10, 2013
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).
}
}
View 5 Replies
View Related
Jan 23, 2013
I'm doing a simple 3D text move in Action and I want to layer it on top of my timeline. After rendering the layers in the timeline, it seems that my matte is messed-up (see attached).
View 2 Replies
View Related
Sep 13, 2012
I frequently record Illustrator Actions. My actions are quite long, but they all involve three common steps:
-Assigning Notes to shapes
-Assigning Swatches to shapes
-Selecting shapes that have a specific notes
I often need to re-record my actions to repeat all the steps, but to change the notes/swatches that are selected/assigned during the action.
Illustrator has a re-record command. This command is great for changing the value of the note in number 3 of my list. However, it does not work for items 1 & 2 in my list. For these items I have to delete the old step in the action and then record a new step with the new swatch/note.
I know macros in Microsoft Office have an editor which allow you to change values in actions. Is there anything similar for Illustrator actions?You can save an Illustrator action and open it in Text Edit. However, all the attribute/swatch values are saved as weird strings, so I don't know how to change them.
View 4 Replies
View Related
Jul 10, 2013
I've seen on this forum a lot people saying that in CS6 you can now call an action from JavaScript. However, I haven't been able to find what the syntax is to do that in the reference or the guide. Can you actually do this now with Javascript?
View 2 Replies
View Related
Jul 17, 2013
I need to create an action. A simple one. The idea: One path is selected, a user runs the action, it makes a copy of that path, moves the copy, select both the path and its copy and makes a blend.
I tried to record that action, but Illustrator does not record the paths selection/selecting.
Even a simplier task: How, in general, having one path selected, select an item/path above or below it? And how to select them both?
I can make a script for that, but the requirement is to keep it as simple as possible: have an Action only without any scripts, if possible.
View 2 Replies
View Related
Jun 8, 2012
I created an action to change the width of an image. I execute the action using DoScript javascript method.
The first action Obj1 will select the whole image and second action Obj2 will open the transform panel and change the width of the image.
app.Open("D:LWW_Castoff45991_09_03.eps")
app.DoScript("Obj1", "LWW")
While (app.ActionIsRunning)
Thread.Sleep(500)
[Code]...
In the above code, the second action 'Obj2' is not getting executed. Both the actions are getting executed individually. Let me know the problem and how to execute both the actions.
View 5 Replies
View Related
Sep 9, 2013
I'm playing around with attaching an action to a button in javascript but I'm just not getting it
I've tried putting it into a function like so
function deleteSwatches () {
= app.doScript("Delete Unused Swatches", "Custom Art Actions");
}
Then calling the action with said function but it doesn't respond.
View 2 Replies
View Related
Oct 9, 2012
I need to do a form of automation, but wanting to execute this from another process (self-made application). Adobe Photoshop has this mechanism called "Droplets" that are executable based upon Actions defined in Photoshop (as far as I can understand). Is it possible to let AI do some work for you from an external application as with Photoshop (assuming you are able to execute the executable once it has been created)?
View 4 Replies
View Related
Mar 8, 2013
I would like to automate an action set that selects a raster image (linked file) that has been grouped with vector art and then converts that selected raster image into a vector (live trace)
I'm using cs5 on a mac. As far as format goes I have hundreds of eps files that all have at least one raster bitmap tif which was imported as a linked file and then grouped with vector art. So I will like to run a batch script command that will select only that bitmap raster image (because I want to maintain the present vector art in the file) and convert that bitmap tif to vector- and save the file which will hopfully be in vector format.
View 2 Replies
View Related
Jun 3, 2012
Is it possible to trigger actions from the actions panel using javascript? I see that you can do this with AppleScript but I've written everyting so far in javascript and don't know AppleScript, though could learn it if I need to.
I'm writing a script that creates a lot of complex graphic files and have all the prototypes done except for wanting to change the color of a few of the points in a mesh object. Apparently this can't be done in javascript, so I was hoping to mid point in the script, trigger an action from the panel to edit the mesh, then let the script carry on its way.
Is this possible?
View 5 Replies
View Related
May 13, 2013
I want to move a layer or a selection in a straight line.
for example: I have a layer and only want to move it horizontally and NOT vertically.
Is it possible in GIMP? If yes, how?
View 3 Replies
View Related
Apr 16, 2013
I tried following action script code to save PDF file with color profile attached:
var saveOps: PDFSaveOptions = new PDFSaveOptions();
saveOps.colorConversionID = ColorConversion.COLORCONVERSIONTODEST;
saveOps.colorDestinationID = ColorDestination.COLORDESTINATIONWORKINGCMYK;
saveOps.colorProfileID = ColorProfile.INCLUDEDESTPROFILE;
doc.saveAs(pdfFile, saveOps);
But got following errors: error an Illustrator error occurred: 1346458189 ('PARM'). What is the correct way to save PDF file with color profile?
View 1 Replies
View Related
Oct 3, 2011
I created an Action to batch export a folder of .ai files to create 300dpi .png's of the .ai file's artboard. I did this by simply recording "Export...as png" with my desired settings then Batch running the Action on desired folder of .ai files. The files were successfully exported, the trouble is that the exported files lack a .png file extension. My intent is to take these PNG files and merge them into a single PDF using Acrobat Pro. Unfortunatly, without the .PNG extension, Acrobat Pro does not recognize the file types and does not let me use the Combine Files feature on them. Going back and manually adding a .png at the end of the exported files defeats the time-saving purpose of Batch Processing all together. Is there something I am missing or doing incorrectly? I have included screenshots of 1) My Batch Action settings 2) folders showing files without .png extension and 3) visual of what I see when I am trying to combine PNGs into a PDF.
View 4 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
Feb 18, 2013
I'm trying to create a script via javascript for Illustrator.
My problem is : I have a AI file with multiple layers, i want to create one artboard per layer, in order to export a multipage PDF ( each page contain 1 layer ).
The layers represents the differents type of print ( vernish, color, hot gold, pressure ... ) and/or color type ( Pantone, CMYK, cut, kisscut ... ). My client want a PDF for see each type of print or color type per page.
I'm trying 2 ways :
1st solution : Create new artboards, and duplicate ( or move ) layers content on the new artboad, but the function move/duplicate don't work to move content on another artboard.
2nd solution : Create new document with the same number of layers as artboard and duplicate layer to the new artboard on the new document.
View 6 Replies
View Related
Sep 6, 2012
I'm new to illustrator scripting (but not to javascript or programming. I have an AI file that has multiple layers. each layer has several items that are supposed to be of same color. I have an array of HEX values.
I would like to loop over all items in a single layer, select them and change their color to some given HEX. Once that works, I will run on all HEX entries in array and save each variation in a separate PNG file.
For the first part i wrote some script (see below), but i do not see any change in the file after i run the script. No errors and no change. I run the script once i select all items in a specific layer.
My code:
function hexToRgb(hex) {
var result = /^#?([a-fd]{2})([a-fd]{2})([a-fd]{2})$/i.exec(hex);
return result ? {
r: parseInt(result[1], 16),
g: parseInt(result[2], 16),
b: parseInt(result[3], 16)
[Code] ......
View 3 Replies
View Related
Jun 21, 2013
All I am trying to do is move an anchor from one location to another using vbscript. I have searched everywhere and scoured the scripting references but I have not been able to figure this out as of yet.
I am able to select anchor points without an issue....moving those points seems to be a problem.
View 5 Replies
View Related
Jul 10, 2013
I have a document with a single layer and a single group (GroupItem) in that layer.
Unfortunately, I didn't create the .ai file, so I don't know exactly what is in the group; however, there appears to be a bunch of complex clipping masks and gradient effects, etc. deeply nested within it.
I've successfully scripted a few tasks like resizing the group with no ill effect... in other words, this works as expected:
app.activeDocument.activeLayer.pathItems[0].resize(50,50);
However, as soon as I try to move/translate/reposition the group, all the effects/masks seem to go wonky, I've tried all of the below with no success (200 is just arbitrary as a test):
app.activeDocument.activeLayer.pathItems[0].left = 200;
app.activeDocument.activeLayer.pathItems[0].translate(200,0);
I have no problem moving the group around on the document with my mouse... all the effects/masks are still nice and clean, so I'm confused as to why I can't do the same thing via JavaScript.
View 3 Replies
View Related
May 7, 2013
I wish to resize a selection around a custom 2D point. I have had a look at the resize function:
#target illustrator
sel = app.activeDocument.selection[0];
var scale = 200;
var scaleAbout = Transformation.TOPLEFT;
[Code] .....
Which works allright but I assume that I need to use the constants defined in the Transformation class? I cannot just input a 2D point to scale around? Would be handy. I have a feeling that I need to use a transformation matrix to do this.
View 4 Replies
View Related
Sep 17, 2012
I am trying to find out if there is a way to select only the objects within a selection marquee? In AutoCAD you can make a selection window from left to right and only those objects entirely within the window are selected. If you window from right to left all objects that are "crossed" or touched by the window are selected. Is there a similar technique in Illustrator?
Currently I have to select the objects, then go back and hold the shift key to deselect the object I don't want, or put objects on different layers then lock layers to prevent extra objects getting selected.
In AutoCAD, my primary program, you simply draw a selection window, left or right, depending on what your next step would be. No special tools or toggles or thinking ahead, it's just the primary selection process and very intuitive.
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
Aug 21, 2012
Recently I met a little problem about save selection. I want to get saved selection list so that I can used in javascript. Some useful information about how to get Saved Selection list in javascript!
View 2 Replies
View Related
Aug 25, 2013
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();
}
}
View 7 Replies
View Related
Feb 17, 2014
how do I center my current selection to the artboard? just like hitting the "horizontal align-center" and "vertical align-center" buttons. I've been searching for the last two hours and before my head hits the keyboard.
What I'm struggling with: in my init function i create a new document and then copy all layers from the previous document step by step to the new document and then save it as SVG.
// Init
(function(){
destination = Folder.selectDialog('Select folder for SVG files.', docPath);
if (!destination){return;}
holderDoc = app.documents.add();
stepThroughAndExportLayers(docRef.layers);
}());
my problem is that holderDoc = app.documents.add(); always creates a document that is not the same size as my initial document where the layers get copied from.
so I want the exact same artboard size as in my initial document.I'm fine with either doing it as fixed values or taking directly the values of the inital doc. i tried this in the segment where I create the new document:
// Init
(function(){
destination = Folder.selectDialog('Select folder for SVG files.', docPath);
if (!destination){return;}
holderDoc = app.documents.add();
holderDoc.artboards[0].artboardRect = [0,0,128,128];
stepThroughAndExportLayers(docRef.layers);
}());
and get this error message: "Error 1200: an Illustrator error occured: 1346458189 ('PARM')
Line: 83
-> holderDoc.artboards[0].artboardRect = [0,0,128,128];"
which from what I've read on the web means that illustrator doesnt know what document to pick. but i have called it directly. I do not want to fit the artboard to the images/layer. the artboard should always have a certain size. (for me 128px by 128px)
// edit: workaround
(function(){
destination = Folder.selectDialog('Select folder for SVG files.', docPath);
if (!destination){return;}
var activeArtboard = app.activeDocument.artboards[app.activeDocument.artboards.getActiveAr tboardIndex()];
var ABRect = activeArtboard.artboardRect;
holderDoc = app.documents.add();
holderDoc.artboards.add(ABRect);
holderDoc.artboards.remove(0);
holderDoc.artboards.setActiveArtboardIndex(0);
//stepThroughAndExportLayers(docRef.layers);
}());
i now added a new artboard to the new document with the same size as the artboard on the initial document.i remove the predefined artboard on the new doc and set the new artboard as active the artboard is now not centered into the window. which lets illustrator place my image with ctrl+c -> ctrl+v somewhere outside the artboard.
i now need to align my selection to the center of the artboard. but i cant find any reference on how to center a selection to the artboard.
View 7 Replies
View Related
Oct 23, 2013
Basically, I have an open AI document and would like to duplicate its artboard and then move it to a new position(X axis, 50pixels away from the original). Doesn't seem too hard, but I can't figure it out. This is for CS5.
var docRef = app.activeDocument;
var abSrc = docRef.artboards[0];
var abSrcX = abSrc.artboardRect[0];
[Code]...
Taking that into account if I add (1224 + 144) to abSrcX and abSrxW it creates another artboard 2" away from the previous at 17" x 11". If I want to run it again, I just to add (1224 + 144) to abSrcX and abSrxW again. Now to figure out how to do this dynamically on the fly.
View 5 Replies
View Related
Jun 29, 2013
I have a grid of objects—say, tiny squares. I'd like to make arbitrarily-shaped selections of those objects—for instance, select a star-shaped group of the squares. Or a circle-shaped group of the squares. Or use text paths to select letter-shaped groups of the squares.
I could imagine a utility that lets me choose an arbitrary shape/path, and then turn that into a selection of objects on the canvas. Is this possible?
Right now I'm stuck using the lasso tool to hand-draw shape selections but it's not accurate enough for what I need to do.
View 1 Replies
View Related
Aug 17, 2012
I'm trying to nudge the anchor points on an object randomly (to get an informal look). (I know some Effects do this already.)
Maintaining corner points is no problem - you just set the direction handles to the same coordinates as their anchor.
But I can't nudge a smooth point in the way I want to, which is to move the anchor but maintain the direction handles in exactly the same relation to their anchor as they had before. That is to say, they should remain smooth points.
My script calculates the difference between 'before' and 'after' positions of the anchor, and applies that difference to the direction handles… but in practice the smooth points are converted to corners, because the direction handles don't maintain their relation with the anchor.
var docRef = activeDocument;
var objects = activeDocument.selection.length;
var cShift = prompt("Point shift (pt)",5);
// loop through all objects
for(var count=0;count<objects;count++)
[Code] .....
View 2 Replies
View Related