Illustrator Scripting :: How To Get Contents Of A Specific TextFrame Within First Group On Layer
Sep 11, 2012
I think I might be doing this wrong, I am trying to get contents of a specific textFrame within first group on layer called "page numbers"
It seems to work, but is a bit sketchy, the documentation indicates textFrame is all the text frames in a document, and that textFrameItem should be the specific one within collections of groups etc, maybe I am misunderstanding. this is what I am using:
var existingPageNumbers = app.activeDocument.layers.getByName('page numbers').groupItems[0].textFrames[0].contents;
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 am working with scripting in Ai, fill gradient color in TextFrame. I search in this forum but the other topics fill color to path or line. For now, I can make a gradient color, but I don't know how to apply it to textframe.
I'm trying to read a text file into a textFrame. It reads in but is not including linefeeds so it's just one big long line of text. I'm using the following code to read the file. I attempted to insert a character after each readln() but that didn't work. I also tried creating a variable that the readln() was stuffed into before setting the textFrame.contents to the variable, but that didn't work either. I'm stumped.
while (! notesDoc.eof) { noteTextRef.contents += notesDoc.readln();}
* this script will prompt the user for a file name and location and then save the current file as a .pdf with secure save options*/ var curDoc = app.activeDocument; var destName = prompt ("Enter a Filename Daniel", "", "Save With Security"); var destFolder = Folder.selectDialog('Select which folder to save to :'); saveFileToPDF(destFolder+ '/' + destName); // not sure if i need this here ?
[Code] .......
i can do the math of (artboard width)-(text width) / 2 is start point of text but how do i find out the text width and the artboard width?
I'm trying to find the smallest textframe within a group and then matching that textframe font size to the minimum size allowed for printing. Everything else works, except I can't figure out how to resize the textframe while also resizing its parent, the group.
I have a quite large Photoshop document where I've drafted up a number of pages for a website, and I require guides which are specific to certain layers or groups, and not just to the whole document. Is this possible? Any plugins which serve this purpose, or functionality I'm missing?
Why my AutoCad 2009 will not let me select new layers to a specific group layer filter. It was working just fine and yesterday all of sudden it will not let me add new layers to a specific filter. Is there a button or command that maybe would have changed that function. Everything else seems to be working on the Layer Manager.
When i call the method selectObjectsOnActiveArtboard on an artboard, is there a way to easily group all items in the selection? Like in the menu found under "right click > group"
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:
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):
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.
I have a layer that contains two clipping groups (groups with a clip mask and other art). When I call layer.groupItems it returns an empty array. When I call layer.layers it returns the two clipping groups. I need to know if these layers are clipping groups, but if they are coming back as layers how can I figure that out?
I'm working with imported graphics, and the objects appear in the AI layer hierarchy grouped and named according to their object types in the native program (see the attached image). The problem lies with the annotation objects: they are made of different parts for which different graphic styles are needed; however, they all come in one layer and are difficult to access for global operations. I need to do different things with the different object types (delete the POINT's, move the LINE's and LWPOLYLINE's to different layers, etc...). The option of selecting objects individually is ok for small data sets, but you can imagine this becomes untenable in a hurry.
Two possible solutions I've considered:
(1) change the output parameters in the source program such that the objects come into illustrator with different graphics allowing them to be accessed through the "Select same ..." tools; it would work, but is problematic for the source program
(2) print the annotation graphics with their desired graphic appearance to pdf rather than importing the source file directly in AI, then open in AI to render the remaining graphics; again, this works but introduces inefficiency in the process. Also, the print process tends to explode closed paths requiring more inefficient path tinkering in AI.
I would like to tell AI to select all objects named "POINT" or "LINE" etc... but have found nothing in the documentation or forums on whether this is possible.
All the graphics in my document is selected. I want to deselect groups and leave standalone items selected. How can i make JavaScript recognize a group?
I'm having trouble getting a script together where I can ungroup all groups in a document, then put everything under a single group. Everyhting I'm working with has a single layer, but for some of the arts I'm importing have groups within groups ect. To run certain actions I've made properly after I need eveything to be in one, single group.
I searched for an answer and found this (wirtten by Carlos Canto)
function ungroup(whereToUngroup, group) // where to ungroup? layer, document, other group? { for (i=group.pageItems.length-1; i>=0; i--) group.pageItems[i].move(whereToUngroup, ElementPlacement.PLACEATBEGINNING); }
I have multiple icons placed in a document, from several different sources (all are vector objects) -- see the included image. They vary in size and what I would like to do is find a less onerous method of resizing all the heights to a specific size, while scaling the width proportionately. I have found several scripts that come close to a solution (see links below), but none that allow me to input a height (or width) in inches and have all the objects resize to that height proportionately.
Change Width to the Width of the narrowest object --> Script01 Change Height to the Height of the shortest object --> Script02 Change Multiple Attributes (JohnWundes) --> Script03
icon image (couldn't place via Adobe Forum) --> click
I want to open a doc, run a script that selects all paths of a color, say 255,0,0 or 50,0,20,4 and changes that color to black or another color I specify and also changes the stroke. Is this possible? I can't see how i would do it?
I want to send the contents of A1 to an Illustrator document at 135, 172 and B1 to 135,190, same with A2/B2 will be at different coordinates as will A3/B3 and so on... I want to do this 6 times and save the document as a PDF. Then, it should clear and do it again. The columns will ALWAYS be A and B.
I have a group called "grey button" with a text layer ("ok, got it") and a shape layer ("large grey") within in it. Sometimes the two elements within the group show up in the layers palette, sometimes they don't. Sometimes when I click the drop down for the group folder, it looks to be open but nothing shows beneath it. Sometimes when I can get the items within the group folder to show beneath the folder, then close the dropdown, the folder looks closed but the elements are still showing beneath it.
I was curious if there is a way to lock a specific attributes contents in autocad 2012. I have an attribute with a field inserted that I don't want people to be able to change. If this is possible
I've many layers with sub-layers in it. The problem: All layers (containing sub-layers) are shown opened in the layer pallette on document opening. How can I convert a layer into a simple group preserving the name? Are there a (semi-)automatic approach to convert all sub-layers into groups?