Illustrator Scripting :: Moving Object (JSX) Using Its Width?
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;
You know the width tool? The one that lets you add "width points" to a line to adjust the width of the line at the point? I want to be able to script that!
Basically, my project is to add a bunch of width points to a line and give them random widths at those points. I'm planning on doing a LOT of these, so I'd rather not do them manually.
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.
I found this script that makes the selected objects the same width AND height. I am very new to creating scripts. is it possible to modify this to make an object the same width leaving their heights the same?
mySelection = activeDocument.selection; if (mySelection.length>0){ if (mySelection instanceof Array) { goal=mySelection[mySelection.length-1]; for (i=0; i<(mySelection.length-1); i++){
To get the top, left and width of an groupitem without Clipping mask. Actually the group has Clipping mask. But i need only the width of the selection (without Clipping mask). I got these properties in scripting but including the clipping mask. The GUI itself shows different (i.e. Info -->: X:0 mm, Y:0 mm, W:full width [including clipping mask]. Transform palette -->: X:43.00, Y:22.0, W:64 [excluding clipping mask])
How can I get width that multiple selected items? (Not grouped.)
//---------- source code ---------- var mm = 2.83464566929134 //unit conversion. (point->milimeter) var W = docRef.selection[0].width/mm; alert(W); //---------- source code ----------
Im struggling with the correct use of symbol / symbol items in applescript. I can successfully list the symbols used on the page, but I cannot select them. How I can select all the items on the page that are Symbol Items of symbols named "Apples" but not oranges? After that I hope to replace the instances matching the height or width of the items whichever is greater with a 3rd item name. Javascript is always an option as well but I had the same difficulty.
I have an AI file containing seamless pattern swatches.I'd like to get each swatch vectors (ie : access the swatch groupItem). It's doable when clicking on the swatch panel and dragging the swatch on the document, or even double clicking the swatch in the swatches panel, I'd like to do it with javascript.
how to access swatch patterns properties.
How to access the swatch properties, like when double clicking on the swatch in the swatches panel, how to "simulate" a drag & drop of the swatch to the document, I'll take it too, though I think it is not the most convenient way to do.
I'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.
I am using a script to move anchor points on a path that I have. When I move the anchors, the handles remain in the same location and I am getting very poor results. I was wondering if there was a way to move handles WITH the anchor points. Basically keep them relative to the anchors.
Below is how I am moving the anchor. I know that you can use leftDirection and rightDirection to move the handles, but I would like them to move the same way they would if you moved the anchors when selecting them in Illustrator.
Set currentPoint = targetPathItem.PathPoints(13) currentPoint.Anchor = Array(-1537.21, 2735.96)
In a training video on Illustrator cs6 a device is shown as follows, as the instructor manually resizes an Artboard using the Artboard tool:
Justin, the instructor, calls the little box that immediately shows width/height a "width and height box" but searching on that term is not productive. When I run the program the device is not available, not does the video explain what option makes it available or what might have changed on my particular copy to obscure or disable the box. While I know I can get the same effect by choosing the Info window, and can even adjust the parameters more precisely using the control panel bar, I would like to have the convenience of this box.
I note that in the same video series (from Lynda.com) the same type of display device is shown when the instructor resizes a graphic. After some 30 minutes of Google searches and searching for the identity of this device and how to enable it I come up empty.. An experienced Premiere editor, I'm trying to widen my skill set into more of the Adobe suite and new to Illustrator;
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.
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.
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) {
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
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)
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
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?
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).
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.
we have a problem with Illustrator.Illustrator pulls behind selection. You can't select an object with the Selection tool, without afterwards draw the object by moving the mouse. A new installation and resetting Illustrator was unsuccessful.
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
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?
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(); }
I have been following this tutorial: [URL] .... in which artwork is mapped to the perspective grid.
Towards the end of the video (7:00) a sign is mapped to the left grid then moved perpendicular along the right grid ... this is achieved by holding down the tilde key.
When I hold down the tilde key and move the object (which is selected with the perspective selection tool, with the correct grid selected ) it does not map it perpendicular as in the video.
I have deleted my illustrator preferences file (in case any settings were causing this feature not to work). Also if I create a new object and press the tilde key and drag I can create multiple instances, so the tilde key at least in this case is being recognized.
I'm working in a file zoomed fully to 6400%. I've changed the Keyboard increment to the smallest it will allow to 0.0036 mm.
I have two lines. Line 2 sits on line 1, a fraction above. When I select line 2 and press the down arrow key, it jumps so that line 2 is now a fraction below line one. I cannot get the lines to sit perfectly onto of one another.
I have tried to move the line using the mouse, but it snaps to the same position as the keyboard press.
I have turn off snap to grid, snap to point, all the guides, smart guides.