I'm in need of help and have NO idea what I'm doing. I have an excel file with thousands of rows, each with a column for the x-coordinate, the y-coordiante, the height, and width of a rectangle. I need a script that will ask me to select the excel file, read the excel file, and create rectangles from each of the thousands of rows. I imagine this would be pretty simple for somebody who knows what they're doing, but I have no idea where to start. I'm working in a windows environment and have Illustrator CS4. Any suggestions? Any scripts out there that might give me a start?
Create rectangles from info in excel file . . . Help!
Split Text into Layers
I was wondering if anyone is aware of a script that is able to do the same as this photoshop one http://www.agasyanc.ru/text-splitter, I would use that one in photoshop but its not working in CS6.
I was hoping to find a script that will seperate the text into layers ready for export to After Effects to be used in Kinetic Typography pieces
thank you
Relink many files at once
I was wondering if anyone can help. I'm using Illustrator CS6. I have an artboard with 200 of the same placed file. I now want to use this same layout for 30 other views, they are the same size, but different images. If I relink them I have to click through each one. I tried using a script I found on here by Carlos:
#target Illustrator
// script.name = relinkAllSelected.jsx;
// script.description = relinks all selected placed images at once;
// script.required = select at least one linked image before running;
// script.parent = CarlosCanto // 7/12/11;
// script.elegant = false;
var idoc = app.activeDocument;
sel = idoc.selection;
if (sel.length>0)
{
for (i=0 ; i<sel.length ; i++ )
{
if (sel[i].typename == "PlacedItem")
{
var iplaced = sel[i];
var file = File.openDialog ("open file " + iplaced.file );
iplaced.file = file;
}
}
}
else
{
alert("select at least one placed item before running");
}
and I get an
error 25: Expected: }.
Line:10
-> p.p1 {margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Times}
Any Ideas? I'm on a mac, os x 10.6.8. and I copied the script into the script preset folder so its starting from the drop down menu. Don't think I'm leaving anything out. I'm swapping 1 placed(linked) PDF for another.
Thanks
Marcus
Coordinate system in illustrator
Hi. I'm trying to build a shape in Illustrator CS6, OSX 10.7.5, using a script with setEntirePath. I begin with:
var aPoints = new Array ([20, 50], [60, 30]);
pShape = app.activeDocument.pathItems.add();
pShape.setEntirePath(aPoints);
I expected a diagonal line on my artboard but it is actually drawn outside it. From this I gathered that the y axis is considered inverted in javascript and so I have to change the code to var aPoints = new Array ([20, -50], [60, -30]); to get the intended result.
To me this is not intuitive at all. Is there a reason this happens? And is there a way to change it so I can write the y coordinates the way they actually appear on Illustrator, with (0,0) at the top left and positive values to the right and down?
Thank you.
Move layers to new artboard
Hi everybody,
I'm trying to create a script via javascript for Illustrator.
My problem is :
I have a AI file with multiple layers, i want to create one artboard per layer, in order to export a multipage PDF ( each page contain 1 layer ).
The layers represents the differents type of print ( vernish, color, hot gold, pressure ... ) and/or color type ( Pantone, CMYK, cut, kisscut ... ).
My client want a PDF for see each type of print or color type per page.
I'm trying 2 ways :
1st solution : Create new artboards, and duplicate ( or move ) layers content on the new artboad, but the function move/duplicate don't work to move content on another artboard.
2nd solution : Create new document with the same number of layers as artboard and duplicate layer to the new artboard on the new document.
Can you help me to realize this script ?
Excuse me if my english is not good.
Illustrator script to open file in Photoshop
The Bridge SDK has a script to open a selected file in Photoshop.
Can this be done from Illustrator instead?
It seems that the cross-dom function open() should work in either an illustrator or bridge script, yet the following does NOT work in Illustrator.
Fresh from the Bridge 5.1 SDK, it doesn't work in Bridge either, but that's for a different forum.
var t = app.activeDocument.fullName;
Photoshop.open(new File(t));
It provides me with Error 2: Photoshop is undefined.
So, any ideas on how to make this work?
This is all leading up to the real problem, which is to create a 150dpi jpg file, which Illustrator won't do.
Thanks All.
--Alex
Add all items from a layer
I'm creating an function which add all items to a layer but i just cant find the correct way.
What i've got so far is:
function importItems(layer)
{
for(var i = 0; i < layer.pageItems.length; i++)
{
var pageItem = app.activeDocument.layer[0].pageItems.add();
pageItem = layer.pageItems[i];
}
}
CSV WINDOWS
Hi,
I have this script to read a text in Illustrator and then save as a CSV but when I open the CSV nothing changed.
My OS is windows
#target illustrator
var textFile = File ("C:\Documents and Settings\Rodrigo\Desktop\FORMS\entendendo CSV.csv");
var doc = app.activeDocument;
var docText = '';
for (var i = 0; i < doc.textFrames.length; i++)
{
docText += doc.textFrames[i].contents + '\r';
}
alert(docText)
textFile.open('e');
textFile.write(docText);
textFile.close();
Thanks.
Ai Packaging Script
Ok.. I'm sure this has been posted before (already searched, didn't find however), but does a file packaging script exist for AI? (one that collects all linked images and fonts and places them in one place) This would be IMMENSELY helpful to me if anyone can post a link to one or even be willing to write it.
OS: W7
AI Version: CS5
Thanks in advance!
Script works Great, Pro-Tips appreciated.
This script is used to make a few changes that SOME of our die suppliers require. It works great. If you have a little time to look it over and give me some advice on best practices, consiseness etc. it would be greatly appreciated.
Note: The files this script is aimed at are fairly civilized, and don't vary much so I didn't have to buld in room for varience. For example, the die lines will ALWAYS be a spot color, so I didn't need to include anything for RGB or CMYK.
// script.name = prepDieFile.js;
// script.description = removes unnecessary layers, vectors, and text. Leaves cross-mark line unpainted. Colors all remaining text and strokes black;
// script.requirements = an opened document;
// script.parent = elDudereno // 10/10/13;
// script.elegant = false;
#target Illustrator
var idoc = app.activeDocument;
var pi = idoc.pathItems;
var tf = idoc.textFrames;
var deletedLayers = 0;
var deletedPaths = 0;
var spotStroke = 0;
var deletedText = 0;
var blackedText = 0;
var layerCount = idoc.layers.length;
//loop through all layers deleting hidden layers. Loop from the back, to preserve index of remaining layers when we remove one.
for (var i = layerCount - 1; i >= 0; i--) { var thisLayer = idoc.layers[i]; if (thisLayer.visible == false || thisLayer.locked == true) { thisLayer.visible = true; thisLayer.locked = false; thisLayer.remove(); deletedLayers++; }
}
unlockPaths();
//locate largest path item (bounding box) and lock it.
var theBiggest = pi[0];
for (i=1; i<pi.length; i++) { if (Math.abs(pi[i].area) > Math.abs(theBiggest.area)) { theBiggest = pi[i]; }
}
theBiggest.remove();
deletedLayers++;
//locate second largest path (cross-mark size) remove stroke and lock
var secondBiggest = pi[0];
for (j=1; j<pi.length; j++) { if (Math.abs(pi[j].area) > Math.abs(secondBiggest.area)) { secondBiggest = pi[j]; }
}
secondBiggest.strokeColor = NoColor;
secondBiggest.fillColor = NoColor;
secondBiggest.locked = true;
// loop through path items delete if hidden, registration, or un-stroked. Change all non-registration spot colors to 100% GrayColor.
for (var j=pi.length -1; j >= 0; j--) { var ipath = pi[j]; if (ipath.hidden==true) { ipath.remove(); deletedPaths++; } if (ipath.locked==false) { var strokeColor = ipath.strokeColor; if (strokeColor.typename == "NoColor"){ ipath.remove(); deletedPaths++; } else if (strokeColor.typename == "SpotColor"){ if (strokeColor.spot.name == "[Registration]"){ ipath.remove(); deletedPaths++; } else { ipath.strokeColor = GrayColor; ipath.strokeColor.gray = 100.0; spotStroke++; } } }
}
unlockPaths();
// delete text frames with first letter set to registration. Turn all other text to black.
for (t=tf.length -1; t>=0; t--) { var iTxtFrm = tf[t]; var firstLtr = iTxtFrm.characters[0]; if (firstLtr.characterAttributes.fillColor.spot.name == "[Registration]"){ iTxtFrm.remove(); deletedText++; } else { var chars = iTxtFrm.characters; for (var c=0; c<chars.length; c++) { var ltr = chars[c]; ltr.characterAttributes.fillColor = GrayColor; ltr.characterAttributes.fillColor.gray = 100.0; blackedText++; } }
}
redraw();
alert(deletedLayers + " hidden or locked layer(s), " + deletedPaths + " path(s) & " + deletedText + " text frames, were deleted. " + blackedText + " letters, & " + spotStroke + " stroke(s) were converted to 100% K.");
//unlock all path items
function unlockPaths(){
for (var k=0; k<pi.length; k++){ var lpath = pi[k]; if (lpath.locked == true){ lpath.locked = false; } }
}
Thanks for taking a look.
http://www.filedropper.com/0388701die<-sample file.
Illustrator Timestamp
Is it possible to create a script for Illustrator that would "timestamp" the file when edits/changes have been made?
Extracting data from Excel To Illustrator javascript or vbscript
Hi all-
I was wondering if there was a way to extract data from Excel to be used in Illustrator. I know there is an option of variables and xml, and I don't want that. I've seen and tried out how to read illustrator and write to excel, and I get that. What I would like to do is pretty much the opposite:
1.Pre-fill in an Excel file(.xls,.csv, doesn't matter) with data such as a filename in column 1 and (Replacement Text) in column 2 and close manually.
2. Run script(VBSCRIPT,Javascript, doesn't matter)
3.For each column in Excel file where cell in first column is not empty, open Illustrator Template with placeholder of "DWG" textframe and replace the frame titled "DWG" with Replacement text from Excel in Column2.
4, Save each to a PDF file and name file with text from Excel Column1(Filename)
In a nutshell, there will be a single illustrator template with a premade textFrame with a name of "DWG". Excel will contain two columns, one for the filename to be named and one for the relative text to replace with the placeholder in AI. I hoped I explained this well enough without causing too much confusion. Thanks in advance.
| Filename | Replacement Text |
|---|---|
test1.pdf | DWG01 |
| test2.pdf | DWG02 |
| test3.pdf | DWG03 |
| test4.pdf | DWG04 |
Batch font face and size change
Hi everybody,
I'm looking to create a batch action/script the will select and change the font face and size in a series of .eps files of barcodes.
I'm not sure if it's a scripting thing because I've never scripted before.
If anyone could point me in the right direction or tell me how to do it (action or script) I'd be very grateful.
(Each image contains the barcode and three text elements, all Helvetica 24pt which I want to change to OCRB 18.5pt, on about 120 images)
Thanks chaps
Sort artboards by name
We have over 50 artboards in most of our documents. Is there a way to sort the artboards as listed in the artboards panel by name via script?
How can i make it? (something like 'Feather effect')
Hi.
I get some object to other design company.
There is AI file in URL(illustrator CS3 version file)
http://www1.datafilehost.com/d/f873f882
it's looks like 'Feather effect'. but it's not.
it's not possible to copy to below Script code.
Sel[i].duplicate(newGroup, ElementPlacement.PLACEATEND);
So i started wonder about it.
How can i make this object?
and, How can i copy this object to script code?
Thanks you.
Batch replace color with another color
Hi,
I would desperately need some assistance in trying to accomplish batch editing of ai-files via JavaScript.
What I would need to do, is go through a number (many!) of files, find items with certain swatch color (referenced by its name), and replace the item-fill with another swatch-color (also referenced by its name). Then save the document with another name.
Other parts I have managed to do, except find/compare/modify the fill color of an item.
I have gone through these forums and tried a number of things to a point where I am currently very confused and frustrated
Some details (if it helps any), I'm using Illustrator CS3 and JavaScript.
Here's the closest where I got with trying to find a certain color and eventually changing it:
#target illustrator
var sourceFile, findColor, replaceColor;
sourceFile = new File().openDlg('Please select your Illustrator file…');
open(sourceFile);
var docRef = app.activeDocument;
findColor = docRef.swatches.getByName("vih");
// replaceColor not yet used anywhere
replaceColor = docRef.swatches.getByName("sin");
for(var obj = docRef.pageItems.length - 1; obj >= 0; obj--) { if(docRef.pageItems[obj].fillColor == findColor) { alert("Match found"); //It never seems to get here, so my comparison clearly is not working? } else { alert ("No specified color found!"); }
}
docRef.close();
(and yes, I'm completely new with java-scripting, so even this is constructed from bits of sample-scripts and other scripts found from these forums)
Please, I would really appreciate any help, this can't really be such a difficult task to do... can it?
BR,
Johanna
an Illustrator error occurred: 1346458189 ('PARM')
Hello everyone,
I am trying to open some documents in Illustrator CS4 by javascript, walk through all layers including sublayers, doing something (for now just reading the layernames and showing them at an alert), closing the document and continue with the next document in the given folder until all documents in that folder are done.
By doing so I found an error I never have seen so far and I cant figure out where it comes from exactly to get rid of it.
The Error an Illustrator error occurred: 1346458189 ('PARM') appears randomly when cycling through the layers of the document but only every second document, so I guess there might be something wrong with closing a document and realeasing all references but I could not figure out what.
Maybe someone got an idea on this problem? Posting my sourcecode (just a simple test-code) below.
#target illustrator
var sourceFolderPath = "/e/TestAI";
var destinationFolderPath = "/e/TestZielverzeichnis";
var fileNameDefinition = "*.ai";
var sourceFolder = new Folder(sourceFolderPath);
var destinationFolder = new Folder(destinationFolderPath);
runCheckTool();
function runCheckTool() {
var contentInput = sourceFolder.getFiles(fileNameDefinition);
var fileRef;
var docRef;
for (var i = 0; i < contentInput.length; i++) {
fileRef = null;
docRef = null;
try {
fileRef = new File(contentInput[i]);
docRef = open(fileRef);
} catch(e) {
alert("# 1: " + e);
}
try{
checkLayers(docRef.layers);
} catch(e) {
alert("# 2: " + i + " " + e);
}
try {
docRef.close(SaveOptions.DONOTSAVECHANGES);
alert("end file index: " + i);
} catch(e) {
alert("#3: " + e);
}
}
}
function checkLayers(layerRef) {
var countLayers = layerRef.length;
for (var j = countLayers - 1; j >= 0; j--) {
if(layerRef[j].layers.length > 0) {
checkLayers(layerRef[j].layers);
}
alert ("Layer: " + layerRef[j].name);
}
}
Cutting a circle
Hi all,
I need to make shapes like this based on a value for graph purposes - usually I would just create a cutting shape based on trig (this shape representing around 60%) and subtract it from the path - I have about 30 graphs to do and I need to base it on a variable, and I want to use script - I'm sure there must be a better way, and I'm hoping you guys have the answer.
Thanks in advance
Dave
After restart, Illustrator cs5 errors when executing script
I have a scheduled task that executes a javascript file (jsx) against Illustrator. It always throws an error after I restart the computer though. To fix it, I have to open Illustrator myself and create a new document. Then I close Illustrator and rerun the script and it works fine.
Error message is CS5.5ServiceManager.exe encountered a problem and needed to close.
Any ideas on how I can fix this?
Change font in Illustrator cs4 js
I need to assign specific font to my text and it doesn't work. What am I doing wrong:
var my_OUTSIDE_TextFrame = myInstrLayer.textFrames.add();
my_OUTSIDE_TextFrame.geometricBounds = ["1.6 in", "1 in", "1.85 in", "2.75 in"];
my_OUTSIDE_TextFrame.contents = "OUTSIDE";
var myParagraph = my_OUTSIDE_TextFrame.paragraphs.item(0);
try{
myParagraph.appliedFont = app.fonts.item("Myriad Pro");
}
catch(e){}
try{
myParagraph.fontStyle = "Bold";
}
catch(e){}
myParagraph.pointSize = 30;
And it's not placing it where I want it either.
Thank you very much for your help.
Yulia

