Quantcast
Channel: Adobe Community : Popular Discussions - Illustrator Scripting
Viewing all 12845 articles
Browse latest View live

Illustrator scripting bug list.

$
0
0

Hello dear friends, the time has come... to assemble a list of bugs we want to have eliminated.

I've come into contact with an engineer on LinkedIn and he has this to say in a private email exchange:

 

Me: "I have a variety of issues I can provide you with, including cases provided by other scripters around the world. Would you want to focus on any specific issue at first, or do you wish to get the entire catalog of reports?"


Him: "Entire catalog in a prioritized list will be great. I can then get into a conversation with developers with this doc. Also, anything you can do to help me explain why fixing something “non obvious” is important will also help me."

 

Okay, so let's put some list together to send him and hopefully it can start some ball rolling.
I think we should come up with a format to document each "situation" , as these bugs are not typical user bugs and are sometimes more elusive.


Setting the bleed in AI via Javascript

$
0
0

Hi All,

 

I'm writing a function to change the artboard size and add bleed depending on certain conditions.

I can't actually believe this is causing me trouble but here it is, I'm trying to set the bleed dimensions in AI document with Javascript. All I've found so far is setting up PDF export options or print options, but not the actual artboard Document Setup. I just want to be able to set bleed to a newly created document like in this window:

So similar to Indesign:

 

with(myDocument.documentPreferences){  documentBleedUniformSize = true;  documentBleedTopOffset = 7;  }

 

(CC2017)

Screenshot 2017-04-06 15.45.28.png

Shortcut for js script with CS4 ?

$
0
0

hi all,

with my old version of illustrator (CS), i might affect a shortcut to a specific scipt .

Now i have CS4 version, and i  don't find similar possibility.

 

how can affect in this new version ?

 

Thanks for futur answer.

Calling functions from UI palette

$
0
0

Hello,

From what I understand, you can't call complex functions from a scripted UI palette, only from "dialog" windows (which are usless in my case) because I need the persistance of a palette.

 

I have a series of scripts in use now that are  accessed from the usual "file-scripts folder" within Illustrator itself (about 27 of them).  I want to script a palette window so users can acces them without the usual mouse clicks down the menu system.

 

I'm able to call a simple "Hello World" type function using the "onClick()" method from a button of a scripted palette window, but I cannot use my regular working scripts inside a function that's called from the button.  In X-Code, I was able to write my scripts individually, then just add them to a main floating window via a separate function when they were completed.  But, I'm finding Javascript a little more tricky.

 

If I copy my other's script code into the function in the palette window script, it runs, but it runs before I click the button! --  After in runs, then the palette window is displayed(?).  If I try to use the execute() method with "onClick", the script just opens in the SDK, it will not and does run in Illustrator.

 

I take both of these as clear indications that I have no clue what I'm doing (or that I'm trying to do the impossible).

 

I did find someone with a similar problem, but they were scripting After Effects and were offered this solution:

 

system.callSystem ('afterfx -r "/C/Program Files/Adobe/Adobe After Effects CS3/Support Files/Scripts/GlobalVars.jsx"');

 

 

Is there anything I can do in Illustrator that will allow me to call (or execute) my other scripts/functions and have them execute within Illustrator?

 

Thanks for any and all help!

Resize Artboard

$
0
0
Unsure if Im asking in the right spot but is it possible to automate the resizing of the artboard say from A0 down to A1

Script for making an object the artboard size.

$
0
0

I am looking for some help on trying to make an object the exact size of the artboard.  This is something I do on a daily basis for several different reasons and it would be very helpful if this can happen automatically for whatever size the artboard may be.  As I understand it the only way is with a script but I have no experience with making illustrator scripts, im definately no programmer.  I have set up quickkeys in the past to copy from the artboard inputs when you are on the artboard tool but these round to the nearest .01 and this is not accurate enough for what I am working with.  Also if I do this with multiple pages open illustrator is very slow to respond to the artboard tool.  If anyone has any idea where to start or has seen other such scripts I would greatly appreciate it.  Thank you.

 

Below is a script that I saw on here that I believe may contain what I need but now knowing programming I have no idea where to start on editing.  All I need is the part where an object is placed on the artboard that is the exact same size as the artboard.  If anyone can advise on editing I would greatly apprecaite it.

 

#target illustrator

function main() {
     if (app.documents.length == 0) {
          alert('Open a document before running this script');
          return; // Stop script here no doc open…
     }else{
          var docRef = app.activeDocument;
          with (docRef) {
               if (selection.length == 0) {
                    alert('No items are selected…');
                    return; // Stop script here with no selection…
               }
               if (selection.length > 1) {
                    alert('Too many items are selected…');
                    return; // Stop script here with selection Array…
               }else{                   
                    var selVB = selection[0].visibleBounds;
                    var rectTop = selVB[1] + 36;
                    var rectLeft = selVB[0] - 36;
                    var rectWidth = (selVB[2] - selVB[0]) + 72;
                    var rectHeight = (selVB[1] - selVB[3]) + 72;              
                    selection[0].parent.name = 'CC';
                    selection[0].filled = false;
                    selection[0].stroked = true;
                    var ccColor = cmykColor(0, 100, 0, 0);              
                    var ccCol = spots.add()
                    ccCol.name = 'CC';
                    ccCol.color = ccColor;
                    ccCol.tint = 100;
                    ccCol.colorType = ColorModel.SPOT;
                    var cc = new SpotColor();
                    cc.spot = ccCol;                   
                    selection[0].strokeColor = cc;
                    selection[0].strokeWidth = 1;                   
                    var tcLayer = layers.add();
                    tcLayer.name = 'TC';
                    var padBox = pathItems.rectangle(rectTop, rectLeft, rectWidth, rectHeight, false);
                    padBox.stroked = false;
                    padBox.filled = true;
                    var tcColor = cmykColor(0, 100, 90, 0);         
                    var tcCol = spots.add()
                    tcCol.name = 'TC';
                    tcCol.color = tcColor;
                    tcCol.tint = 100;
                    tcCol.colorType = ColorModel.SPOT;
                    var tc = new SpotColor();
                    tc.spot = tcCol;
                    padBox.fillColor = tc;    
                    padBox.move(docRef, ElementPlacement.PLACEATEND);
                    artboards[0].artboardRect = (padBox.visibleBounds);
                    redraw();
                    rectWidth = (rectWidth-72)/72;
                    rectWidth = roundToDP(rectWidth,1);
                    rectHeight = (rectHeight-72)/72;
                    rectHeight = roundToDP(rectHeight,1);
                    var textString = rectWidth + ' x ' + rectHeight;
                    prompt('Copy Me', textString);
               }         
          }
     }
}

main();

function roundToDP(nbr, dP) {
     dpNbr = Math.round(nbr*Math.pow(10,dP))/Math.pow(10,dP);
     return dpNbr;
}

function cmykColor(c, m, y, k) {
     var newCMYK = new CMYKColor();
     newCMYK.cyan = c;
     newCMYK.magenta = m;
     newCMYK.yellow = y;
     newCMYK.black = k;
     return newCMYK;
}

fill color using a script.

$
0
0

I'm trying to create a script in CS5 mac os10.6.8 that will change the fill color of selected pathItems. I need a simple script that will change a selected pathItem to cmyk values 2,3,15,0. I will then select this script and implement the action in a batch of 600 files.

 

I wish this process could be recorded as an action but when I record the action "add new swatch" I have to manually input the cmyk values, which will take forever for a batch of over 600 files.

Importing CSV and TXT files as Illustrator datasets: VariableImporter.jsx

$
0
0

Just in case any body would like to have the ability to import .csv and tab-delimited .txt files into Adobe Illustrator as datasets, (similar to Indesign's Data Merger), here is a tool which will help you out. Using the VariableImporter, it is now possible to import those formats, designate header columns (which will be variable names in Illustrator), and to specify Text/Visibility/Link variable types for each variable.

 

To assign visibilitydesignation to a variable, you can use the # ('pound') symbol in front of the column name.

To assign linked file designation to a variable, you can use the @ ('at') symbol in front of the name.

The names have to follow XML tag naming standard:

  • Names can contain letters, numbers, and other characters
  • Names cannot start with a number or punctuation character
  • Names cannot start with the letters xml (or XML, or Xml, etc)
  • Names cannot contain spaces

 

The link to the file in repo is here:

Adobe-Illustrator/VariableImporter.jsx at master · Silly-V/Adobe-Illustrator · GitHub

For those who may now know:

To run, go to above link, and click on the "Raw" button, download by using browser's context menu and choose "Save As" with a .jsx extension. It will run when double-clicked, and also by choosing File > Other Script inside Illustrator.


Anti-aliasing Type Optimized/Art Optimized on PNG export

$
0
0

Hello there,

 

I'm modifying a javascript that makes an export of each layer contained in an Illustrator document and I want to specify the method used for anti-aliasing (either Type Optimized or Art Optimized). Similarly to the option under the "Image size" tab in the "Save for the Web" panel.

 

I didn't find any antiAliasingMethod property in the ExportOptionsPNG24 properties (only an antiAliasing property that accepts boolean). So I wonder if it is actually possible to do it through scripting?

 

Many thanks,

D

Run Plugin from script.

$
0
0

Hello. I Have big or small job . I have to write nesting script ;/ I know this is not easy job. But I need any advice how can I do in Illustrator. By Colission detection? Or I need to write another application between illustrator and javascript. My company currently use eCut. It work fine, but over 200 files should be done automatically

. Meaby is way to run eCut plugin by javascript.(Effect>eCut>Nesting). But I don't know how to do it.

 

Thanks for any advice.

Multiple Line Replace Script?

$
0
0

I've been trying to modify this script to ignore case (so it works with uppercase and lowercase) as well as work when there are line breaks between words. Often some of the longer terms have a line break between them such as:

Arabian

Desert

And I want to still replace the term with my target language (with no line break would be fine).

I've tried modifying the script to work with RegEx but I can't get it to work. Any help would be greatly appreciated.

 

function FindAndReplaceScript_AllOpenDocuments(){             for(var i=app.documents.length -1; i > -1;  i--){               app.documents[i].activate();           var aDoc = app.documents[i];    
//List of words to replace         var mapObj = {             "Damascus":"ដាម៉ាស",             "Rabbah":"រ៉ាបាត",             "Samaria": "សាម៉ារី",
            "Arabian Desert": "ទីរហោស្ថានអារ៉ាប់"
            };                                var theTF = aDoc.textFrames;               if (theTF.length > 0) {                   for (var j = 0 ; j <theTF.length; j++) {                       var aTF = theTF[j];                      for (var re in mapObj) {                 var newString = aTF.contents.replace(re, mapObj[re])                 if (newString != aTF.contents) {                           theTF[j].contents = newString;                       }                   }      }         }       }   
};       
FindAndReplaceScript_AllOpenDocuments();    

JETalmage's Script Library

$
0
0

Hi -- just wondering if anyone knows what became of the great repository of AI scripts JET had posted on the web -- I have been using a modified version of his Label Script and went looking recently for his other ones, but all the links point to a site that is now under construction. Are they archived elsewhere? or is JET coming out with a commercial package (I'll be first in line to buy!)?

 

Thanks!

 

-g-

JavaScript to prompt user to save as PDF

$
0
0

I am making changes with code to the file. I want the user to be prompted to save as a .ai file first. I have that down. Now I am wanting to have the user immediately be prompted to save as a pdf with only the optimize for fast web view option selected. I believe it is an adobe preset of Smallest File Size.

The reason for wanting the prompt is because I want to save the files in 2 different locations.

Here is my code so far.....

var doc = app.activeDocument;
// Save as .ai file 
var fileName = doc.fullName; 
var thisFile = new File(fileName);
var saveFile = thisFile.saveDlg();
doc.saveAs (saveFile);


// Save as .pdf file
var pdfSaveOptions = new PDFSaveOptions(); 
pdfSaveOptions.pDFXStandard=PDFXStandard.PDFXNONE; 
pdfSaveOptions.compatibility = PDFCompatibility.ACROBAT5; 
pdfSaveOptions.preserveEditability = false;  
var pdfFile = new File(fileName); 
doc.saveAs(pdfFile, pdfSaveOptions);

AI CS4 Windows 7 64bit

Illustrator Find And Replace

$
0
0

Hi there,

 

Can anybody tell me if it's possible to JavaScript Illustrators Find And Replace text function?

 

I know it's possible in InDesign but I can't find anything for Illustrator.

 

Many Thanks,

Nik

A Script to Find and Replace Layer Names

$
0
0

Are there any scripts to find and replace layer names?

 

There is an excellent script available for Photoshop which allows you to not only replace words in layer names, but also insert words as Prefixes, Suffixes and Sequential Numbers.

The illustrator version of this script only allows sequential numbering: It doesn't offer find and replacing of words.

 

Ideally, it would be great if there was something that could do multiple find and replaces in one go:

(e.g.

You have layers like this Car, Dog, Bat

You enter: car(Option1), dog(Option2), Bat(Option3)

Your layers then become: Option1, Option2, Option3).

)


How can I install the ExtendScript toolkit?

$
0
0

I want to write scripts for Illustrator. My copy of Illustrator CC 2018 on my iMac is installed and running perfectly, so I thought I could just get working on scripts.

 

Adobe'sscriptingguide at https://wwwimages2.adobe.com/content/dam/acom/en/devnet/illustrator/pdf/AI_ScriptGd_2017.p dfsays, on page 9, that the ExtendScript toolkit can be found on my Mac at the location

 

system drive:Applications:Utilities:Adobe Utilities CC:ExtendScript Toolkit CC

 

 

But it’s not there. In /Applications/Utilities there are multiple Adobe files and folders, but none named “Adobe Utilities CC”. There is “Adobe Utilities - CS6”, which is apparently a legacy from my old copy of Illustrator CS6, and there’s the “ExtendScript Toolkit CS6” inside of that, but that’s dated from 2015. I would like to be using the current CC version, which isn’t there. I searched this directory, as well as the Illustrator application directory, but aside from the CS6 version, there’s nothing with the word “ExtendScript” in there.

 

Can someone help me either locate ExtendScript Toolkit CC, or download a working version?

 

Thanks!

How can I give text variables names to artboard names?

$
0
0

I am currently trying to learn to script, am quite at the beginning. And I am wondering how to access the variables content, at the moment I only managed to access the variable?

 

screen.png

 

Hope that makes sense.

Please advise.

 

Regards, Eva

Linked files name

$
0
0

Hi again guys!

Is there a script to copy the file name and extract some

charactes from the linked and selected .eps file?

 

Ex:

> Original name of the linked and selected eps file:

FILE1.ASD.eps

 

> Extract 5 letters only from that name with the script:

FILE1

 

I have to open many files but I wanna copy

the file name so easy like this with a little script.

 

I just need the code that and will put it in a button.

Many thanks for your help guys!

How to make key object via jsx to perform "Align to Key Object"

$
0
0

Hi, Is there any way to make the object as a key object via script to perform "Align to key Object" in Illustrator. I need it urgently. Thanks in advance

Optimize objects stacking order for vinyl cutting

$
0
0

Hello,

i am looking for a script for optimizing vinyl cutting speed.

The script should be similar to following , but needs to sort the selected objects by the relative position to page origin and not the height from page origin as it does now

script from Arranging stacking order from top to bottom

//David Entwistle

 

var thisDoc = activeDocument;

 

// get selected objects

var selObj = thisDoc.selection;

 

// count the selected objects

var selObjCount = selObj.length;

 

// sort selected objects by their height from the page origin

var byProperty = function(prop) {

    return function(a,b) {

        if (typeof a[prop] == "number") {

            return (a[prop] - b[prop]);

        } else {

            return ((a[prop] < b[prop]) ? -1 : ((a[prop] > b[prop]) ? 1 : 0));

        }

    };

};

 

var symbolsSorted = selObj.sort(byProperty("top"));

 

// for each object in turn in the ordered selection, BringToFront

for(i = selObjCount; i >0; i--){

          var currObj = symbolsSorted[i-1];

          currObj.zOrder(ZOrderMethod.BRINGTOFRONT);

}

 

redraw();

alert("Selected Objects Sorted = " + selObjCount);

 

 

Any help is welcome

Panagiotis

Viewing all 12845 articles
Browse latest View live


Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>