Applescript / Javascript > Adobe Illustrator scripting
Some Illustrator 10 Javascripts I use
(1/1)
markuso:
Hi, All!
Since this forum has been helpful, I thought I would post some of the AI10 javascript I've used:
===========
// Delete each embedded image
countOfRasterItems = activeDocument.rasterItems.length;
for (r=countOfRasterItems-1; r>=0; r--) {
var targetItem = activeDocument.rasterItems[r];
targetItem.remove();
}
===========
// List all active fonts - one at a time
for (i=0; i<textFaces.length; i++) {
var fontToTest = textFaces;
alert("Font " + i + " is " + fontToTest);
}
===========
// Unlock all visible layers
countOfLayers = activeDocument.layers.length-1;
for (j=countOfLayers; j>=0; j--) {
targetLayer = activeDocument.layers[j];
if (targetLayer.visible == true) {
targetLayer.locked = false;
}
}
===========
// save all open documents as flash documents
numDocuments = documents.length;
for (i = 0; i < numDocuments; i++) {
aDocument = documents;
theDocumentName = aDocument.name;
flashOptions = new ExportOptionsFlash();
flashOptions.curveQuality = 10;
flashOptions.generateHTML = true;
flashOptions.jpegQuality = 10;
flashOptions.readOnly = true;
flashOptions.replacing = SaveOptions.SAVECHANGES;
flashOptions.resolution = 300;
docPath = aDocument.path;
docPathStr = docPath.toString();
if (docPathStr.length > 1) {
documentPath = docPath + "/" + aDocument.name;
} else {
// This is a brand new file and doesn't have a path yet,
// so put it in the illustrator application folder.
documentPath = path + "/" + aDocument.name;
}
theFile = new File(documentPath);
aDocument.exportFile(theFile, ExportType.FLASH, flashOptions);
}
===========
// Find and Remove all text strings
countOfTextItems = activeDocument.textArtItems.length;
for (e=countOfTextItems-1; e>=0; e--) {
var targetText = activeDocument.textArtItems[e].contents;
if (targetText == "Redneck") {
targetItem.remove();
}
}
============
I'll post more later . . . duty calls!
Mark
markuso:
If anyone is interested, I'll post more . . . .
Mark
norbert_ds:
Hi Mark,
Do you have an export to JPEG where all the otions available in illustrator's user interface have been scripted?
Regards
Norbert
markuso:
Hi.
Here are the possibilities for 10 & CS2...
antiAliasing - Boolean (default true)
artBoardClipping - Boolean (default false)
blurAmount - number from 0.0 to 2.0 (default 0.0)
horizontalScale - number (default 100%)
matte - boolean (default true
matteColor - RGBColor object (default white)
optimization - Boolean (default true)
qualitySetting - number from 0 to 100 (default 30)
saveAsHTML - Boolean (default false)
typename - string (read only)
verticalScale - number from 0 to 100 (default 100)
Hope this helps!
Mark
Navigation
[0] Message Index
Go to full version