Illustrator Scripting :: Changing Line Of Text In Multiple AI Files
Apr 5, 2013
I have about 500 files that I need to change one line of text in. Example. File name is XXX 001, the line of text is the file name so it would read XXX 001. XXX 002... etc. up to XXX 500. Is there a way that I could automate it opening, changing this line of text, saving and closing?
I have about 300+ product labels that are in Illustrator, and some of them have an incorrect rich black color swatch. What I have been doing is going through and changing the color pallette to change them manually. Essentially going to the instance of black and changing them to regular black.
Is there any sort of script that can do this? The files are in CMYK.
Otherwise I have a lot of monotonous file editing to do.
I'm trying to change/access the opacity of a text object (Illustrator CC). In the documents, I found that it's represented by a text frame object, but it doesn't have opacity property. Text range and character attributes don't have it either, so I'm wondering: is there any way of accessing/altering the opacity of a text object using Javascript?
I’m working with PDF files in illustrator and whenever the file uses Helvetica I have to change the font to Arial. This gets old when working with hundreds of illustrations. How I would go about changing all text that uses Helvetica bold to Arial bold and Helvetica Roman to Arial?
Would I loop through all the text frames and get the value of the font and use that value to change them or is there a more global way to go about this?
Is it possible to have a script that would split up an Illustrator file that contains a number of groups of elements into individual files... for example, here is a download link for a file that has different types of moustaches and I want each moustache as an individual file... I have hundreds of Illustrator files like this that have 4, 8, 15, 20 or more illustrations all bunched onto the one file that I need to split up. I'm using CS4 [URL]....
I have 30 separate illustrator pdf files (one page each) that I would like to make into one Illustrator CS6 file with 30 artboards. Is there any way to do that without having to import one by one?
I have an Illustrator document with one layer (named Layer 1).In that layer are lines, rectangles and text.Is it possible (in script) to: make 3 additional layers named NL, EN and GEselect and cut all the text in Layer 1paste that text in the same place in the layers NL, EN and GE
(Step 2: select all text items and Ctrl-X) (Step 3: select proper layer and Paste in Place in that layer)
I know this can be done with an action (I did that allready) but the reason I want to script this is because I have to combine this with another script which takes care of colorizing stuff.
I try to open mulitple ai files through palette dialog but it fails on Error:8702, there is no document. But if i change to var win = new Window ("dialog", "Batch"); the open file works well.
var txtSourceFolder = win.add("edittext",undefined); var btnOk = win.add("button",undefined,"Run"); btnOk.onClick=function(){ try
What would be the best strategy on the usage of data set to translate our product packaging. It's quite complex as we have several languages on the same packaging. Moreover, we have different text sources that would require to be translated in different sets of languages.
I have already looked into the data set and I tried to get familiar with it. How to create the data set and how to name the different variables knowing that there are different source texts for a particular region (region means a set of languages) and other texts for another region... The idea is to export this into one XML file with well identified elements that can be split with a tool, sent for translation according to their region then merged back into one single file to be imported back into illustrator
Region 1: en-US text 1 text 2
fr-FR text 1 text 2
de-DE etc...
Region 2: en-US text 3 text 4
ru-RU text 3 text 4
Region 3: etc..
It seems that the formatting such as bold, italic and so on is not exported into the data set which is quite embarrassing.
I was editing a file in illustrator that a past designer set up and he set it up so that there are multiple lines in a column of text that are linked some how so that the first line of text can be edited and the rest will change with it.
I´m aware that Illustrator doesn´t have multiple artboards options for JPG as it does with eps, or other formats, but is there any workaround for this? Looping current artboard and exporting them to JPG or something. Or maybe there is someway to force the "save multiple artboards:true" in JPG?
export document currentDoc to file exportFolder as JPEG with options ¬ {class:JPEG export options ¬ , quality:100 ¬ , artboard clipping:true ¬ , artboard range:1 - 2 ¬ , save multiple artboards:true}
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)
I'm trying to swap symbols in situ by changing the 'name' property of the symbol instance.
My rudimentary script can find the existing symbol name (for me, that's a small triumph!). The Illustrator document has two symbols in the Symbols panel, 'blue_square' and 'red_circle'. I run the script with an instance of 'blue_square' (and nothing else) on the page, and try to change the name to 'red_circle':
var docRef = activeDocument; var symbolitem = docRef.symbolItems[0] var symbolname = symbolitem.symbol.name; var newname = "red_circle"; symbolitem.selected = true; // this next line causes the problem: symbolitem.symbol.name = newname;
Suppose I have an object filled with a linear gradient. This object is the only selected. I just would like to change the angle of the gradient to 25 degrees. So I think I could do:
var doc = app.activeDocument alert(doc.selection[0].fillColor.angle) // the result is the exact angle of the gradient fill of the selected object. Suppose 12 degrees.
//now the try to change: doc.selection[0].fillColor.angle = 25.0
No errors are found by the Extended Script Toolkit..BUT...it does not change anything. As Illustrator reference manual does not say this property is read only, I think I could write.
how to apply multiple strokes to a path with JavaScript? Assigning strokes width, caps, position in stack (my particular concern)? All i can do at the moment is to apply a single stroke.
I have been tying to figure out how I could easily embed multiple linked images easily. I have some 1000 .svg images which have about 1-7 .tif images linked in to them. I now need to get those links embedded and becouse of the amount of images I'm hoping to make an action out of it. I have a script to embed single image in .svg but haven't have luck with multiple embeddings.
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 ----------
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); }
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)?
I am getting an error with a script i have used before without any problems.The script updates the only image at the bottom of a single page PDF and saves the changed PDF in another folder.
It asks me to locate the folder of PDFs to be modified.It asks me to locate the folder where the modified PDFs will be saved.It asks me to select the new image that will be used.It will then update the image and resizes it and save the PDF in the specified folder.
I don't get this error on all PDFs but i get it at least once every 10 PDFs (and there are over a 1,000 PDFs).The error i get is this:
Error 1302:No such elementLine:27-> rip=doc.rasterItems[0].position;
I get this error regardless of whether the script is run in CS3 or CS5.
Additional info.I ran this script in CS3 and it worked. At a later date i ran another script on the folder of modified PDFs in CS5 that deleted any unnessesary elements outside the artboard, it selected All on the Artboard - then inversed the selection - and deleted any selected items followed by save and close.I have tried making sure the "new" image has the same name as the image being replaced but this made no difference.I am using Illustrator on Vista.
I am trying to create a script who could act as an Autocad plot (ie convert each color to black, with a different line weight).
Here is the first script I melted, who create my Black swatch
if ( app.documents.length > 0 ) { var myDoc = app.activeDocument; //add Black swatch var newSwatch = app.activeDocument.swatches.add() var newColor = new GrayColor(); newColor.gray = 100; [Code] .........
And here is the second one, who replace one color by Black (it don't change the text, nor the lineweight yet…
if ( app.documents.length > 0 ) { //test de dialogue function csDialog() { var fabGroup = app.activeDocument.swatchGroups.getByName('Fabrics'); var allFabs = fabGroup.getAllSwatches(); var fabNames = Array();
Is it possible to save illustrator XMP thumbnail previews by artboard? It seems like Illustrator saves a single thumbnail with all art regardless of the number of artboards.
If there is a property that can be set to save multiple thumbnails to the XMP packet by artboard when saving to a native Illustrator file?
I want to create a dialog consisting of multiple buttons. As a result I want value which button was pressed by user.
The script (shortened to problematic part):
// I'm looping through elements on layer 'warstwa' from kolorStart to kolorStop, 'k' is used for number buttons
for (i = kolorStart, k = 0; i <= kolorStop; k++, i++) { myButton[k] = myButtonGroup.add ("button", undefined, warstwa.pageItems[i].contents); myButton[k].label = warstwa.pageItems[i].contents; myButton[k].onClick = function () { wybranyKolor = myButton[k].label; myWindow.close(); } }
The result:
But buttons don't work, wybranyKolor returning 'undefined'. If I change "wybranyKolor = myButton[k].label" to "wybranyKolor = myButton[k-1].label" I get proper answer but it is the same for all buttons so it looks that all buttons have the same action assigned. How to get each button to has unique name which can be passed to variable?
Probably I can achieve the same with radio buttons' list but with buttons it is one click less for the user.