Illustrator Scripting :: How To Select And Copy To Clipboard A Path On Layer
Feb 7, 2012
how the Photoshop DOM works with this snippet but I can't get it to select a pathItem correctly. When testing in ESTK I sometime have to run a line to that sets the path Item selected property to true several times before the path is selected in the GUI.Here is the script I am working on.
copyPathsToPhotoshop()
function copyPathsToPhotoshop(){
var currentLayer = app.activeDocument.activeLayer;
var count = currentLayer.pathItems.length;
var shapeNumber = 105
for( var p=1;p<count;p++){
[code]....
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";
How can I select all objects in a layer and copy and paste the objects into a new document? We are having issues with the copy and paste method. Is this because it uses the operating systems clipboard?
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 have a collection of circles and rectangles in my document. Is there any way to sort out circles from rectagles using JavaScript? Say i want to make my circles red and the rectangles blue.
Is there any way to find a specific point on a path, that is not necessarily an anchor point?
What I'd like to be able to do is tell Illustrator "Give me the coordinates of the point that's exactly at half of this path's length" or "... exactly 25% ...". And if that's possible, can I somehow add an anchor point to that point, or cut the path at that point?
I'd like to be to select a layer groups and copy them over to another pre-existing image.
I've been struggling with this for an hour or so, and I haven't found a way to do this.
Is is possible to do this in GIMP?
The closet I've found is a kind of paste where you do this: drag the tab of the origin image over to the tab of the target image. The result is a new layer in the target image called "dropped buffer". However, the entire origin image is imported flattened.
I've been trying other drag and drop operations, but without success. Usually when I drop the selection to the target image, the icon under the mouse dissapears, and nothing actually happens.
I thought this might be a window manager problem. But I get the same results across kde, gnome and xfce.
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.
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.
I need an Illustrator script for distribute a collection of diferent symbols along a path. The symbols should be distributed from the beginning to end of path and separated a proportional space each other. Additionally each symbol should be rotated pointing to a "look at" object.
Please look at the attached image for further info.
So I deal with a lot of files each day that need to be saved according to their lead code, meaning that there is a folder that holds thousands of sub folders that have the same name as this lead code on a server.
So since I have the lead code in the file name I'm trying to use that in conjunction with the file path to tell illustrator where to save it with Javascript. Also the idea of a dynamic save path is useful.
Here's what I've got so far, it's not working yet but I feel like I'm close.
/*///////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// Dynamic Save Path//////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////*/ #target illustrator
I'm trying to change the colors of a pathItem corresponding to the string value of several text fields in my document. I've been successful in changing the fill and stroke color of the pathItem, but I can not find any reference in the Illustrator Javascript Guide for accessing additional strokes and/or fills that have been applied to the object in the Appearance panel.
I have the common problem to resize the artboard to standardize technical illustrations to the format 50x50mm.
I would like to group the objects for further transformationsI would transform the group to 45mm and scale stroks and effectsN.B.: here It should be a test on landscape format
I would align the group to the page center
Public Sub copy_paste_with_transformation () 'Duplicates grouped items in a new document with landscape sensitive transformation Set appRef = CreateObject("Illustrator.Application")
'calculate the size of objects do define if it's landscape or not Bounds = appRef.ActiveDocument.VisibleBounds
Is there a way to write a script to copy a selected/chosen artboard (and it's contents) to another opened document, placing it in exactly the same place on the global x/y coordinates? I'm either unable to find this feature built in to Illustrator, or it's simply missing.
I've looked around for this but haven't found much. I have a server with thousands of print proof sheets, and since the beginning, long before me, the files were saved with verbal descriptive names. It would be a lot better if they were saved according to the PO number. All the proof sheets have a po number listed in pretty much the same place on the sheet... is there a way to copy that PO number from the field within the pdf, and save the file to a new folder using that number as the filename using a script?
I want to select the objects outside artboard using javascript. Their are many objects outside activeartboard i want to select all those object using script.
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.
I have a script that will select text Frames, but I have come into a situation where I need to exclude any text frames that do not have a fill color. I do not see a filled Boolean property for character attributes or text Frames.
This is what I used to select all text on all visible and unlocked layers. I dont see a way to exclude textframes that have no fillcolor.
if (app.documents.length > 0 ) { var doc = app.activeDocument; var numTextFrames = 0; for ( i = 0; i < doc.textFrames.length; i++ ) { try { textArtRange = doc.textFrames[i]; textArtRange.selected = true; } catch (e) {} } }
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
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).
I have script where I select items on multiple artboard but I can't seem to get get active art board of the selected item. Is this possible?
each artboard has a text item and I would like them in the same position on each of their own artboards that they are already one. right now it adjusts them all to one artboard. here is what I have so far
doc = app.activeDocument; for(i = 0; i < selection.length; i++){ var firstItemPosition = doc.selection[0].position; doc.selection[i].position = firstItemPosition; var activeArtboardIndex = doc.artboards.getActiveArtboardIndex(); alert(activeArtboardIndex); }