Anyone know if there is an alternative to scriptographer until will be released a new version ?
Scriptographer for cs6
Script with text areas that should be compiled together
Hello guys, I'm new in Adobe Community. I have to make a jsx file for graduation.
To complete this file, it needs to perform an operation like the html file posted below:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head> <title></title><script language="JavaScript" type="text/javascript">
/*<![CDATA[*/
function Repeat(source,target){
source.form[target].value=source.value;
}
/*]]>*/</script></head><body><form ><input type="text" onkeyup="Repeat(this,'fred');" onblur="Repeat(this,'fred');" /><input name="fred" type="text" /></form></body></html>With two text boxes in a jsx file, as follows, for Illustrator CS5:
#target illustrator
//#targetengine session
var ppage= app.documents.add(DocumentColorSpace.RGB,600,300);
var area_1 = ppage.pathItems.rectangle( 250, 10, 200, 100);
var content_1= ppage.textFrames.areaText(area_1);
content_1.paragraphs.add("first");
var area_2 = ppage.pathItems.rectangle( 250, 300, 200, 100);
var content_2= ppage.textFrames.areaText(area_2);
content_2.paragraphs.add("second");
Can someone / knows to help me?
Thanks to all!!
Any suggestion will be appreciated!!!
(SORRY FOR BAD ENGLISH, I'M ITALIAN)
Salve, devo realizzare un file jsx, per la laurea.
Per completare questo file, esso deve eseguire un'operazione simile al file html postato sotto:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title></title>
<script language="JavaScript" type="text/javascript">
/*<![CDATA[*/
function Repeat(source,target){
source.form[target].value=source.value;
}
/*]]>*/
</script></head>
<body>
<form >
<input type="text" onkeyup="Repeat(this,'fred');" onblur="Repeat(this,'fred');" />
<input name="fred" type="text" />
</form>
</body>
</html>
Con due caselle di testo, come segue, per Illustrator CS5:
#target illustrator
//#targetengine session
var ppage= app.documents.add(DocumentColorSpace.RGB,600,300);
var area_1 = ppage.pathItems.rectangle( 250, 10, 200, 100);
var content_1= ppage.textFrames.areaText(area_1);
content_1.paragraphs.add("first");
var area_2 = ppage.pathItems.rectangle( 250, 300, 200, 100);
var content_2= ppage.textFrames.areaText(area_2);
content_2.paragraphs.add("second");
Qualcuno può/ sa aiutarmi?
Grazie infinite a tutti!!!
Need to create triangle using angle inputs
Hi All,
i need to create custom trianlge with angle inputs example (30º ,45º, 60º). In the below script links i could find only 2 angles and 1side as input.
Custom Angled Triangles Question
Any updates.
regards,
Vinoth
Illustrator VBA scripting 101 - via Excel
This post will attempt to introduce newcomers to Illustrator Visual Basic Scripting (well, not actually vbs, but rather tru VBA, Visual Basic for Applications). I personally prefer vba over bvs for a number of reasons. First, I always have Excel and Illustrator open, so it makes sense for me use it to drive Ai. Second, I usually need to transfer data between the two programs. Third...I love the Excel IDE...ok, let's get right into it.
- Open Excel
- hit Alt+F11, to bring up the editor
- in the Tools menu, click on References...
- add a reference to "Adobe Illustrator CS5 Type Library"
- in the Personal.xls (or in any other book) add a Module. Personal is a global workbook that is always available. If you don't see it, go back to Excel and record a macro, anything will do. That will create the Personal file.
- and type the following in that module
- we have to continue the tradition and do the "HelloWorld" script
Sub helloWorld() Dim iapp As New Illustrator.Application Dim idoc As Illustrator.Document Dim iframe As Illustrator.TextFrame Set idoc = iapp.ActiveDocument Set iframe = idoc.TextFrames.Add iframe.Contents = "Hello World from Excel VBA!!" Set iframe = Nothing Set idoc = Nothing Set iapp = Nothing End Sub
- save Personal book
- open Illustrator and create a new document first
- to run, move the cursor anywhere inside the Sub...End Sub and hit F5
that's it for now...in the following posts we'll move the text to the middle of the page, create new documents, get data from an Excel Range to Illustrator, get data from Illustrator text frame to an Excel Range...and more, hopefully.
questions? comments?
embed all fonts in eps
I have a lot of existing eps-files of which the option "embed all fonts" is unchecked.
Know I have to check the "embed all fonts" in the existing eps-files.
I tried to modify the script below, but it seems that the embedallfonts is NOT working.
When I do it manually (without script), then it works fine. With script, it doesn't work.
#target illustrator
// PART 1
var doc = app.activeDocument;
// PART 2 -> herbewaren eps als eps
var destFile = new File(decodeURI(doc.fullName).replace(/(?: \[Converted\])?\.eps$/, '.eps')); // also remove "[Converted]" from filename
var options = new IllustratorSaveOptions({}); // new save as options
options.compatibility = Compatibility.ILLUSTRATOR15; // save as CS5
options.embedICCProfile=true;
options.embedAllFonts=true;
options.pdfCompatible = true;
options.useCompression = true;
doc.saveAs(destFile, options); // save the file in the same foldere as the eps
// PART 3
doc.close(SaveOptions.SAVECHANGES); // close the file with saving
Another question will be: can I get a dialog box to put in the path to the eps-files, I can do thereafter it in batch instead of each time opening and closing a file.
Batch export .ai files to pdf
Hi guys, I found a script that does the job, export tones of ai files to pdf, but I have some files which are in sub folders, and I was trying to find a way to modify this script to include subfolder, but no luck.
Would appriciate if anyone colud help.
Thanks.
/**********************************************************
ADOBE SYSTEMS INCORPORATED
Copyright 2005-2006 Adobe Systems Incorporated
All Rights Reserved
NOTICE: Adobe permits you to use, modify, and
distribute this file in accordance with the terms
of the Adobe license agreement accompanying it.
If you have received this file from a source
other than Adobe, then your use, modification,
or distribution of it requires the prior
written permission of Adobe.
*********************************************************/
/**********************************************************
Export to PDFs.jsx
DESCRIPTION
This sample gets files specified by the user from the
selected folder and batch processes them and saves them
as PDFs.
Edits by Patrick Mineault:
- only .ai files processed
- files saved in same folder as the input files
- export files have name (oldname).pdf
- PDF settings: editable / acrobatLayers=true
for maximum compatibility with Preview
**********************************************************/
// Main Code [Execution of script begins here]
// uncomment to suppress Illustrator warning dialogs
// app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;
var destFolder, sourceFolder, files, fileType, sourceDoc, targetFile, pdfSaveOpts;
// Select the source folder.
sourceFolder = Folder.selectDialog( 'Select the folder with Illustrator .ai files you want to convert to PDF');
// If a valid folder is selected
if ( sourceFolder != null )
{
files = new Array();
fileType = "*.ai"; //prompt( 'Select type of Illustrator files to you want to process. Eg: *.ai', ' ' );
// Get all files matching the pattern
files = sourceFolder.getFiles( fileType );
if ( files.length > 0 )
{
// Get the destination to save the files
//destFolder = Folder.selectDialog( 'Select the folder where you want to save the converted PDF files.', '~' );
destFolder = sourceFolder;
for ( i = 0; i < files.length; i++ )
{
sourceDoc = app.open(files[i]); // returns the document object
// Call function getNewName to get the name and file to save the pdf
targetFile = getNewName();
// Call function getPDFOptions get the PDFSaveOptions for the files
pdfSaveOpts = getPDFOptions( );
// Save as pdf
sourceDoc.saveAs( targetFile, pdfSaveOpts );
sourceDoc.close();
}
alert( 'Files are saved as PDF in ' + destFolder );
}
else
{
alert( 'No matching files found' );
}
}
/*********************************************************
getNewName: Function to get the new file name. The primary
name is the same as the source file.
**********************************************************/
function getNewName()
{
var ext, docName, newName, saveInFile, docName;
docName = sourceDoc.name;
ext = '.pdf'; // new extension for pdf file
newName = "";
for ( var i = 0 ; docName[i] != "." ; i++ )
{
newName += docName[i];
}
newName += ext; // full pdf name of the file
// Create a file object to save the pdf
saveInFile = new File( destFolder + '/' + newName );
return saveInFile;
}
/*********************************************************
getPDFOptions: Function to set the PDF saving options of the
files using the PDFSaveOptions object.
**********************************************************/
function getPDFOptions()
{
// Create the PDFSaveOptions object to set the PDF options
var pdfSaveOpts = new PDFSaveOptions();
// Setting PDFSaveOptions properties. Please see the JavaScript Reference
// for a description of these properties.
// Add more properties here if you like
pdfSaveOpts.acrobatLayers = true;
pdfSaveOpts.colorBars = false;
pdfSaveOpts.colorCompression = CompressionQuality.AUTOMATICJPEGHIGH;
pdfSaveOpts.compressArt = true; //default
pdfSaveOpts.embedICCProfile = true;
pdfSaveOpts.enablePlainText = true;
pdfSaveOpts.generateThumbnails = true; // default
pdfSaveOpts.optimization = true;
pdfSaveOpts.pageInformation = false;
pdfSaveOpts.preserveEditability = true;
return pdfSaveOpts;
}
New to Illustrator scripting, looking to make a Compound Path from Existing Paths/Compound Paths
I am wondering how to select existing paths (normal paths and compound paths) and make a new compound path. Google does nothing for me on this....
I have begun to understand the basics of targeting objects and doing some basic changes such as width, height, textFont, positioning and such...but the Scripting Guide is hard for me to wrap my head around as far as compound paths.
I am also having issues understanding the differences between object references that either do or don't have an "s" at the end. I assume there is some uniformity to why many object references have both. Could someone explain the reasoning?
Example
pathItem
pathItems
Thanks in advance!!
James
PathItems index method
Hello all, could anyone give me some examples of how to use the index method pathItems
thank you very much
Script for Selecting Open Paths in Illustrator CS6
I have created this script for selecting open paths in illustrator cs6 as the graffix plugin is not working under CS6.
Just save the following text in /Applications/Adobe Illustrator CS6/Presets/en_US/Scripts/Select Open Paths.js
if (documents.length > 0 && activeDocument.pathItems.length > 0){
var allPaths = activeDocument.pathItems;
var allPathsCount = allPaths.length;
var openPathsAreLocked = false;
var lockedOpenPaths = 0;
var locked = false;
for (var i=0; i < allPathsCount; i++){
allPaths[ i ].selected = false;
if( ! allPaths[ i ].closed){
try{
allPaths[ i ].selected = true;
} catch (e) {
openPathsAreLocked = true;
lockedOpenPaths++;
}
}
}
if (openPathsAreLocked) alert (lockedOpenPaths + " open paths are locked or hidden (or their layer is locked or hidden) and cannot be selected");
}
CHECK BOX
Hello everyone, I'm trying to create a simple window by clicking the check box "select all" all other check box will be selected but do not know which event to use and how to make the window is updated with the check box selected.
Could anyone help me?
The script is this:
# target illustrator
var w = new Window ("dialog");
check1 w.add var = ("checkbox", undefined, "test1");
check2 w.add var = ("checkbox", undefined, "test2");
check3 w.add var = ("checkbox", undefined, "test3");
check4 w.add var = ("checkbox", undefined, "test4");
check5 w.add var = ("checkbox", undefined, "select all");
w.show ();
check2.onClick = function () {
check1.value = true;
check2.value = true;
check3.value = true;
w.update ();
}
Dropdown
Hello friends.
I wonder why I can not change the desired text, please someone tell what is wrong in this script?
#target illustrator
var w = new Window ("dialog");
var myDropdown = w.add ("dropdownlist", undefined, ["one", "two", "three"]);
myDropdown.selection = 0;
var Ok = w.add ("button", undefined, "OK");
w.show ();
Ok.onClick=function(){
var item=myDropdown.selection.text
var myMATERIAL = item;
var myF_MATERIAL = sourceDoc.textFrames.getByName("MATERIAL");
myF_MATERIAL.contents=myMATERIAL
}
Is it possible to create droplet?
Illustrator script to select multiple layers
I have about 74 layers in illustrator and i want to run a script to select combination of layers at a time.
For e.g. I want 5 layers to be selected and save them as one .jpg. Then say i need to select other 3 layers to save it as a seperate .jpg file. If i do it manually it comes upto 300,000 images.
I can create a csv file with all layers to be selected presented in a row. I need help with the command to select 4 or more layers at a time, say if i have layer1, layer2, layer3, layer4 then a command to select those 4 layers and save them as a .jpg file.
Any help will be greatly appreciated.
Thanks
H Patel
CEO
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
UI (Window, dialog, palette etc) reference info for AI scripting
I'm looking for standard reference info on UI elements like popup windows (dialogs, palettes etc). I've been through the Illustrator CS6 Javascript Scripting reference guide and also the CS6 Scripting guide, checking every mention of the words "Window", "Dialog", "Palette" etc (there aren't many), plus related terms like "edittext" and "slider" (which seemingly don't exist in these documents at all), and can't find what I'm looking for.
----------
I'm trying to script a simple info box that contains information generated by a script that doesn't need to be closed before the user continues working.
All I'm trying to find out is the basics. From looking at other scripts I've figured out that you can create a popup box like this:
var box = new Window('dialog', 'Some title');
var panel = box.add(panel, undefined, 'Panel title');
panel.add('edittext', undefined, 'Default value');
panel.add('slider', undefined, /*Default numeric value*/,/*min*/,/*max*/);
var group = box.add(group, undefined, 'Group title');
group = area_len_box.add('group', undefined, 'Title (not displayed)');
group.orientation='row';
group.closeBtn = group.add('button',undefined, 'Close', {name:'close'});
group.closeBtn.onClick = function(){
box.hide(); return false;
}...which is enough for a very rudimentary input system, but one which has to be closed before the user can return to their work - and I can't find any resource that gives the full options:
- What are the other options for 'new Window'? I'm aware of 'palette' which appears to need an array of four co-ordinates like [20,20,100,100], but it clearly needs something else too as every palette I've made instantly closes. And what else is there beyond Window and Palette?
- What other input devices are there beyond edittext and slider, and what parameters do they each need?
- What can go in the "undefined"s I see everywhere these are used?
- etc etc
There must be a reference to this somewhere, but I can't find it.
All Group to Ungroup Script
Download Link
http://www.cyworld.com/be2u/2801831
Feature
This Script is Can be easily ungrouping to all group items in the Document.
if find Bugs or Error, contact to me plz.
License type
Freeware
Author
Nokcha
Author Contact
Author website
Date published
june 30, 2009
Compatible product
Illustrator
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
createOutline in symbol
Hi All,
I've maked a script to create outline text included in symbol:
Below the script:
#target illustrator
var doc=activeDocument;
VectorizSymbolAll(doc);
//************************* functions for Vectorise Symbol ********************************//
function VectorizSymbolAll(Sfile){
var SLen=Sfile.symbols.length-1; for (si=SLen;si>-1;si--){VectorizSymbol(Sfile.symbols[si]);} return true; }
function VectorizSymbol(Ssource){
var a=UnlinkSymbol(Ssource); // unlink
gpOutline(a); // create outline for text
var Scopy=Ssource.parent.symbols.add(Ssource.parent.layers.getByName(a.name).groupItems[0]); //make copy of symbol
Scopy.name="Vect of "+Ssource.name; // name it
Ssource.parent.layers.getByName(a.name).remove(); // remove temp layer
replaceSymbol(Ssource,Scopy); // exchange them
Ssource.remove(); //remove original symbol
}
//******************************//
function UnlinkSymbol(symb){
var Ltemp=symb.parent.layers.add() Ltemp.name="temp"+Math.random(1)*100000; // useless var D=symb.duplicate(); Ltemp.symbolItems.add(D); D.remove() return Ltemp; }
//******************************//
function gpOutline (groupRef) { var textItemsList = new Array(); if (groupRef.groupItems.length > 0) { for (var i = 0 ; i < groupRef.groupItems.length; i++) { var theGroupItems = (gpOutline (groupRef.groupItems[i])); for (var j = theGroupItems.length -1; j> -1; j--) {theGroupItems[j].createOutline();} } } if (groupRef.textFrames.length > 0) { for (var i = 0 ; i < groupRef.textFrames.length; i++) {groupRef.textFrames[i].createOutline();} } if (groupRef.legacyTextItems.length > 0) { for (var i = 0 ; i < groupRef.legacyTextItems.length; i++) { var theTextFrame = groupRef.legacyTextItems[i].convertToNative() theTextFrame.createOutline(); } }
return textItemsList
}
//******************************//
function replaceSymbol(S,C){
for (i=S.parent.symbolItems.length-1;i>-1;i--){if (S.parent.symbolItems[i].symbol==S){S.parent.symbolItems[i].symbol=C}} }
//************************* End of function for Vectorise Symbol ********************************//
It seems works perfectly, but once time, it return an error (i don't remember which.. sorry), and now i'm unable to reproduce it
So if anyone can test / martyrize / stress this script and report me any error / mistake / malfunction / a lapse of memory, i will be happy .
Many thanks at all,
art.chrome
Break text area into text lines
I want to break text area with line breaks in it into seperate text lines using return as delineator. for example
"Line 1
Line 2
Line 3"
I would like as
"Line 1"
"Line 2"
"Line 3"
I could probably write something but curious if someone already wrote it. I found a few similar ones like
http://forums.adobe.com/thread/321610
but they seem to be broken for CC here is the script in case you're curious
/////////////////////////////////////////////////////////////////
//Divide TextFrame v.2.2 -- CS and up
//>=--------------------------------------
// Divides a multiline text field into separate textFrame objects.
// Basically, each line in the selected text object
// becomes it's own textFrame. Vertical Spacing of each new line is based on leading.
//
// This is the opposite of my "Join TextFrames" scripts which
// takes multiple lines and stitchs them back together into the same object.
// New in 2.1 now right and center justification is kept.
// New in 2.2 better error checking, and now will run on more than one text frame at a time.
//>=--------------------------------------
// JS code (c) copyright: John Wundes ( john@wundes.com ) www.wundes.com
//copyright full text here: http://www.wundes.com/js4ai/copyright.txt
//////////////////////////////////////////////////////////////////
var doc = activeDocument;
var genError= "DivideTextFrame must be run on a point-text text-frame. ";
var ret_re = new RegExp("/[\x03]|[\f]|[\r\n]|[\r]|[\n]|[,]/");
if(doc){
var docsel = doc.selection; var sel = []; //remember initial selection set for(var itemCt=0, len = docsel.length ;itemCt<len;itemCt++){ if(docsel[itemCt].typename == "TextFrame"){ sel.push(docsel[itemCt]); } } if(sel.length){ //alert(sel.length+" items found."); for(var itemCt=0, len = sel.length ;itemCt<len;itemCt++){ divide(sel[itemCt]); } }else{ alert(genError +"Please select a Text-Frame object. (Try ungrouping.)"); }
}else{ alert(genError + "No document found.");
};
function divide(item){
//get object position var selWidth = item.width;
if(item.contents.indexOf("\n") != -1){ //alert("This IS already a single line object!");
}else{ //getObject justification var justification = item.story.textRange.justification; //make array var lineArr = fieldToArray(item); tfTop = item.top; tfLeft = item.left; item.contents = lineArr[0]; //for each array item, create a new text line var tr = item.story.textRange; var vSpacing = tr.leading; var newTF; for(j=1 ; j<lineArr.length ; j++){ newTF = item.duplicate(doc, ElementPlacement.PLACEATBEGINNING); newTF.contents = lineArr[j]; newTF.top = tfTop - (vSpacing*j); if(justification == Justification.CENTER) { newTF.left = (tfLeft + (selWidth/2)) - (newTF.width/2); } else if(justification == Justification.RIGHT) { newTF.left = (tfLeft + selWidth) - newTF.width; } else { newTF.left = tfLeft; } newTF.selected = false; }
}
function fieldToArray(myField) { retChars = new Array("\x03","\f","\r","\n"); var tmpTxt = myField.contents.toString(); for (all in retChars ) { tmpArr = tmpTxt.split(retChars[all]); } return tmpTxt.split(ret_re); } }Editing the leading on a created textFrame
Hi,
I have no idea why the following code will not work.
The text displays in the correct place with the correct contents but i cannot get the leading to change.
var textInfo = app.activeDocument.textFrames.add();
textInfo.name = "textInfo";
textInfo.position = [30,-30];
textInfo.contents = "A";
textInfo.autoLeading = false;
for(var i = 0; i<app.activeDocument.textFrames["textInfo"].textRange.characters.length; i++){
app.activeDocument.textFrames["textInfo"].textRange.characters[i].characterAttributes.lea ding = 18;
redraw();
$.writeln(app.activeDocument.textFrames["textInfo"].characters[i].characterAttributes.lea ding);
}
I have also tried textInfo.leading = 18; with no luck.
The write line function at the end is reading the correct leading but the line above is not editing it.
Adobe illustrator CS6, Mac OS 10.6, Javascript/extendscript
Also, not too sure what auto leading does so have tried both with and without.
Thanks,
Tom

