Illustrator Scripting :: Get Position Of Selected Object
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
ADVERTISEMENT
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, 2012
Why does this not work? The textFrameItem.anchor behaves as if it is a read only value but it isn't supposed to be. What am I doing wrong?
function pointText(onLayer,str){
var pointText = onLayer.textFrames.add();
pointText.contents = str;[CODE].....
View 1 Replies
View Related
Oct 24, 2013
How can I get keyboard cursor(caret) position in javascript?
I made a multilined edittext in ScriptUI.
But It's not working about Enter key.
All I want is when I push 'enter' key, begin a new line.
If I know how to get keyboard cursor position, I can insert ' ' character in middle of sentances.
////////////////////////////////////////////////////////////////////// ///////////////
var win =new Window ("dialog", '');
win.orientation = "column";
var grpContents = win.add("group")
var codeInput = grpContents.add ("edittext", [0, 0, 150, 550], "", {multiline:true});
codeInput.alignment = ['fill', 'top']
[code]....
I use windowsXP and Illustrator CS3.
View 4 Replies
View Related
Sep 20, 2012
how can I copy and paste position and size of two objects?
Let's say I have a circle 2 x 2 cm and it's position is y 5cm x 5cm, I have a square of size 3 x 7 cm and it's position is y 0cm x 0cm.
How do I copy and paste in a single command/step the circles position and size to square, so I can get square of 2 x 2 cm and it's position 5cm x 5cm?
Something like copy + paste in place with a different logics. I hope You understand what I want.
I'm doing it now manually, I'm copying size and position of one object to another [ctrl + c > ctrl + v] but it takes quiet a while,
View 2 Replies
View Related
Jun 9, 2012
I'm trying to get the position of point text from left anchor if left aligned, middle if center aligned and right if right aligned. is this even possible?
here are the keys of object I am trying to get at:
keys:
story : [Story]
contents : export me
textRange : [TextRange]
textSelection : [TextRange]
rowCount : 1
columnCount : 1
rowGutter : 0
columnGutter : 0
flowLinksHorizontally : true
spacing : 0
opticalAlignment : false
kind : TextType.POINTTEXT
contentVariable : undefined
orientation : TextOrientation.HORIZONTAL
this is what I am using to get at it:
app.activeDocument.textFrames[2].anchor[0]
am i confusing anchor point with baseline position?
View 3 Replies
View Related
May 3, 2012
Code snippet to show me how to iterate through the selected text (not the frame!, not the words, only the selected chars) and make any change on the characterAttributes (size, color, etc.)?
In the property "app.activeDocument.selection" usually the selected objects are stored as an array. Now when I select characters in a textframe (or TextPath, whatever) there is a [Textrange] in it. I already tried some combinations like this snippet underneath but I still get errors, that selectedChars[i] is undefined.I'm on Illustrator CS4, Mac OS X, Javascript
var selectedChars = app.activeDocument.selection.characters;
for (i = 0; i < selectedChars.length; i++ ){
selectedChars[i].characterAttributes.fillColor = myNewCMYKColor;
View 14 Replies
View Related
Sep 6, 2012
I'd like to draw a box around some selected text (a textRange), however I can't figure out how to detemine the size or position of the text. The overall size of a textFrame is possible to find (not sure about position), but when you've got just a few characters selected I don't see any way to get the size or position.
View 6 Replies
View Related
Nov 15, 2013
Simple solution to aligning selected items to the artboard. I was going to create an action but then realized it would be more convenient for me to include it in my script file....I have a script to align objects with each other but they dont align to the artboard.
View 11 Replies
View Related
Feb 4, 2014
It is possible to apply the Convert to Grayscale(Edit->Edit Colors->Convert to Grayscale) for the selected items in illustrator cs3 in script (javascript)?
View 12 Replies
View Related
Apr 23, 2013
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 ----------
View 3 Replies
View Related
Jan 17, 2014
I was hoping to create a JS script to move objects away from common center based upon their current position. I was thinking to use a single selected path item as the center based on its position x/y and width/height. Using this reference point the script would then move away all other path items from this center point based on a desired amount and with uniform increments given their current location from this center. I was thinking cos and sin would be my friend in this case, however they seem to have become my foe instead. ;-)
Does this sound doable? What am I missing, doing wrong, misinterpreting? Below is a non-working attempt, I can't seem to sort things out, perhaps I was close and missed it or maybe I am super way off and its more complex than I thought. However at this point I am confused across my various failed attempts this only being one of them.
// Example failed code, nonworking concept
var docID = app.activeDocument;
var s0 = docID.selection[0];
pID = docID.pathItems;
var xn, yn;
var stepNum = 20;
[Code]....
View 13 Replies
View Related
Nov 22, 2013
I'm working with 27 artboard in illustrator for one project. I would like to select the object I need to get to in my layers panel and have illustrator "jump/navigate" me to the object where it resides on the artboard. Is this possible?
View 3 Replies
View Related
Jun 5, 2008
I wanted to ask if by chance any of the scripting gurus here happen to have written an AI script that will take a number of selected sublayers/sub-sublayers and move them so they become top-level layers?
I am really needing this very badly, given that After Effects can only handle AI layers as separate entities. So I find myself moving tens, even hundreds of nested sublayers to the top level all the time.
Is it possible this script exists already?
View 16 Replies
View Related
Feb 1, 2013
Is there a method to return an array of paths in the order they were selected, instead of their descending z-index (default behaviour)?
I'm writing a script that "connects" the centers of currently selected objects through a stroked path, and I want it to follow the order in which I select the objects, regardless of the stacking order.
View 13 Replies
View Related
Jan 22, 2014
I am using this script to find and replace words in layers. (The script only targets particualr words, rather than the whole layer name).
I would like to make it so it targets selected layers only.
I have found this script which loops through selected layers only, but I am not sure how to add the find and replace layer name functioality.
View 7 Replies
View Related
Feb 25, 2013
I want to change my selected text to a different cmyk color using javascript. I have tried and I do not know what is missing or what I am doing wrong.
if ( app.documents.length > 0 ) {
newCMYKColor = new CMYKColor();
newCMYKColor.black = 0;
[Code]...
View 4 Replies
View Related
Mar 1, 2013
I'm trying to do some workflow enhancements. For our games we need to export to PNG at different resolutions for different mobile devices. I use a artboard per asset and currently manually export 3 times (using file/export/png with use artboards option), at 72 dpi, 144 dpi and 33.75 dpi.
I've been modifying a simple Javascript I downlaoded and have got it save to different fixed locations at different scales. All good. However exporting every artboard each time will cause issues with our version control system and take too long. It's not really a solution.
So I need a way to either only export the current selected artboards (which I believe can't be done) or somewho show the artboard range dialog that the system uses. Either of those would be a good solution.
var docRef = app.activeDocument;
var num_artboards = docRef.artboards.length;
var getName = app.activeDocument.name;
var fileName = getName.slice(0, -3);
[code]...
View 7 Replies
View Related
Apr 18, 2013
I've written a script to allow you to select an image to replace any number of selected files. Each file starts out as an embeded image with a .note to determine where the basis of alignment for the new file should be (i.e. "top," "bottom," "left," "right"). You'll find the code below:
#target illustrator
if (app.documents.length > 0) {
var docRef=app.activeDocument;
var docSelection = docRef.selection;
// ** Get new file
[Code]...
For some reason, the ".note" added at the end of the script gets erased once the script is complete. I can even get it to confirm that it applied the note to the image, but once it's complete, it's gone.
View 6 Replies
View Related
Feb 20, 2013
Is there a way to send a selected textFrame item to a layer using javascript?
I don't mind if it is send to current layer or some other way to accomplish the task.
(Using Adobe Illustrator CS4)
View 5 Replies
View Related
Apr 2, 2013
I'm trying to create a script in CS5 mac os10.6.8 that will change the fill color of selected pathItems. I need a simple script that will change a selected pathItem to cmyk values 2,3,15,0. I will then select this script and implement the action in a batch of 600 files.
I wish this process could be recorded as an action but when I record the action "add new swatch" I have to manually input the cmyk values, which will take forever for a batch of over 600 files.
View 15 Replies
View Related
Oct 27, 2013
Problem:
How to read real number data from selected columns in an Excel spreadsheet into an illustrator javascript array variable, so that then I can use this information to construct an illustrator polygon.
Further information:
I am new to javascript (and not much of a programmer in the best case, but do have some basic knowledge using ancient languages like FORTRAN 88). I am sure I am just missing an important step here despite all morning browsing with Google for answers (something to do with variable definition I assume?). I have some survey data defining the outline of features in map view listed in a string of point (x,y) values in adjacent columns in excel (these x,y point values calculated from GPS data using a commercial program to converted 3D position to a 2D x,y by geoid projection, and then in excel to re-scale point locations to illustrator’s artboard). What I am trying to do is select columns of x,y value pairs in an excel spreadsheet, copy these values to the clipboard, and then develop an IA JavaScript to draw a polygon through the specified set of x,y points. It seems easy enough to script illustrator to draw the polygon once I get the values from the clipboard are in a javascript array (lots a good tips here [URL] ....), but pulling in the clipboard data seems to be beyond me. I have tried populating a defined array with various combinations of array declarations and app.paste(); or windows.clipboardData.getData('text/plain'); with no satisfaction. I then had the idea to try to pull in the clipboard to one long continuous string, place that in a text box (see see its structure), andthen read and split up the text in a loop to populate the JavaScript array…but that deposited a complex illustrator table object into my text box, and several attempts to force the clipboard to paste text did not work (again probably having problems understanding variable type declaration).
I would be happy to find any method of scripting the pull of the selected on an excel spreadsheet for use in an Illustrator script…so if I am making this all harder than it needs, be I would be grateful to know that also!
View 4 Replies
View Related
Jul 16, 2013
I can't seem to figure out a simple/direct method to identify the index of the selected item in a list box.
I feel like I'm missing something, but I can't seem to figure which (if any) property returns an index number if you use it with the .onChange callback for a ListBox.
The following code accomplishes what I need but isn't particularly efficient or elegant and can get muddled if you introduce multiple lists to check.
Any way to duplicate this same behavior with better code
var res = "palette {text: 'Example List', properties:{resizeable:true}
pnl: Panel{orientation: 'row',preferredSize: [400,600],
list1: ListBox{preferredSize: [400,550], properties:{multiselect:true,numberOfColumns:2, showHeaders:true,columnTitles: ['List 1', 'Subitem 0']}},
}}"
[Code]...
View 4 Replies
View Related
Dec 19, 2011
How to make the following script for adding serial numbers apply to multiple files in a selected folder?
var docRef = app.activeDocument;
with (docRef) {
var docName = name.substring(0, name.lastIndexOf('.'));
var artRight = visibleBounds[2];
[Code] .....
View 6 Replies
View Related
Jun 4, 2010
Is there any way in Illustrator to zoom to selected object (I want to maximize the selected object to the window)? There is the FitArtboard and the FitAll, but a ZoomToSelected.
View 14 Replies
View Related
Aug 15, 2013
Can I setup Illustrator to zoom in and out from the selected object(s) instead of mouse point on ALT and centre otherwise?
View 2 Replies
View Related
Oct 4, 2013
after returning to work in process, i am unable to move any selected object, or to move after selecting and copying and creating a new file?
View 3 Replies
View Related
Aug 16, 2011
How to Raster a object in illustrator with scripting?
View 7 Replies
View Related
Mar 17, 2013
In PS you can drag the center anchor point of an object anywhere within the object or canvas, allowing you to rotate around that custom location versus the dead-center of the object.
View 4 Replies
View Related
Apr 2, 2013
For example, my artboard has 10 logos just need to save one...or save each one individually
View 1 Replies
View Related
Nov 5, 2013
It seems like the Warp tool is just another way to scale an object though it allows you to scale only the selected portion of the object that you touch with it. Is this correct? Does the Warp tool have other functions?
View 2 Replies
View Related