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

JS Convert Spot Colours to process

$
0
0
Help, I'm very new to Javascript. I would like to know to write a Javascript which would convert any spot colours into process colours in Adobe illustrator. Can any help... please.

Cheers Chris

ExportOptionsTIFF not listening to my instructions!

$
0
0

I have discovered yet another inconvenience, and I hope someone may tell me what I am doing wrong.

Using the export TIFF command from an Illustrator document, I am hoping to produce a .tif with 600dpi.

 

#target illustrator-19

function test(){

    if(app.documents.length == 0){

        return;

    }

    var doc = app.activeDocument;

 

 

    var dest = Folder.selectDialog("Choose Folder.");

    if(dest != null){

        var opts = new ExportOptionsTIFF();

        opts.resolution = 600;

        var destFile = File(dest + "/" + "TestFile.tif");

        doc.exportFile(destFile, ExportType.TIFF, opts);

        alert("Successfully exported '" + destFile.displayName + "'.\nNow, check out that resolution...");

    }

}

test();

 

What I have found is that the script ignores my opts.resolution property and just uses the last resolution that was manually set through the File > Export / TIFF format dialog.
I am expecting new ExportOptionsTIFF(); to set the resolution, but it simply taunts me.
Is there anything wrong with my code?

Is there a way to clear or delete actions through scripting?

$
0
0

Hello Everyone!

 

Menu Commands Outline Stroke

 

I'm trying to make a script that will clear and then reload actions to try to get around that bug. Thanks to quertyfly and moluapple I now know how to make actions through script so all I need to know if there is a way to clear actions through script.

 

Thanks Everyone!

Set a gradient from two color swatches

$
0
0

Extremely new to scripting

 

Is it possible to create a script to set a gradient to an object based on colors from the eye dropper

 

Ideally, I'd like it to work as follows, "select 1st color swatch" -> stop and ask for the 1st color (use an eye dropper to pick color) -> "select 2nd color swatch" -> stop and ask for the 2nd color (use an eye dropper to pick that second color)

 

I am hoping this action will minimize the clicking and dragging that I'd have to do to manually select the swatches in the gradient...

Any thoughts on if this is possible?...

Extract text from illustrator for translation then replace with translated text

$
0
0

I am trying to find a way to expedite translations of our drawings.  Each drawing has a series of callouts showing what that piece of the drawing is via text.  I would need to do 100's of drawings for each book.

 

Questions:

 

1. Can I write something to batch a folder and extract the name of the file, and the text from each textbox so that when I get the translation back, I can automate the reinsertion of the translated text to its correct field (i.e. TextField1 = "Translate this" then repopulate that same exact field with "Translation")?  In order to do this I would think each text field would have to be tagged with some unique identifier so that it would know which translation goes where in the drawing.  Keep in mind, I'm ok with manually tagging each textbox if necessary.

 

2. Assuming the above is possible, what would be the best program to write the extracted text to so that reading and writing the translated text back into the drawing is as easy as possible (i.e. Word, Excel, PDF)?

How to change SPOT Color to Process CMYK by disabling GLOBAL Option?

$
0
0

Hi Scripters,

 

i have very big problem to change the SPOT COLOR TO PROCESS CYMK  its working and changing fine but since the "GLOBAL" options is enabled, its not converting the spot into exact cmyk process color.

 

Here is my js code:

 

var myDoc = app.activeDocument;
for(j=0; j<myDoc.swatches.length; j++){
    if(myDoc.swatches[j].color=="[SpotColor]" && myDoc.swatches[j].name!="[Registration]"){
        alert(myDoc.swatches[j].name);
        myDoc.swatches[j].color.spot.colorType=ColorModel.PROCESS;
        }
    }

 

 

thx,

csm_phil

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.

Check for the existence of an expected element

$
0
0

Hello again, scripters!

 

I'm looking for a solution to a problem that has plagued me for quite some time.. In order to make my scripts more robust and less prone to failure, i spend a lot of energy writing test conditions to make sure that an expected element actually exists in the document. Now, this element could be a groupItem or a textFrame or a layer.. Basically anything.

 

The syntax I wish i could use is this:

if(docRef.layers["someLayer"].exists)

     {//do something}

else

     {//do something else}

 

But unfortunately "exists" is not a property of layer/groupItem/textFrame etc.

 

A quick example, since this happens to be what I was working on when i decided to write this post. I like to put stuff into a file upon completion of a task so that at runtime, i can check to see whether said process has already been completed and then determine whether to proceed or not. Perhaps there are better methods, but i typically create specifically named sublayers to indicate a task has been completed. Unfortunately, however, the checks become quite convoluted in order to avoid runtime errors for "no such element".

 

How do you guys check that an important element exists so you can be sure to proceed appropriately? My method seems to always go back to try/catch blocks that can sometimes end up really ugly looking. I think I'm at the point of writing myself an abstract function that I can call whenever I need it, but i wanted to see how you guys handle similar issues before i invest the time into writing something potentially unnecessary.

 

Thanks in advance everyone. =)


Creating Multi-Page PDF from a Layerd Illustrator file (script)

$
0
0

Often times when designing a logo I create different versions and variable options on layers. This can result in several layers in one Illustrator file. Is there an easy way or an existing script that will allow me to (with one click) create a multi-page PDF consisting of all the layers within my .ai file? The current method is turning on each layer, performing a save-as (PDF), then turning off said layer and turning on the next layer and repeating the task and so-on-and-so-forth, etc … It becomes tedious and quite often I save over the previous version, forgetting to re-name it or forget to perform a save on a certain layer. Can anyone help with some advice? I have never written my own script before but am not opposed to trying, where do I begin?

Any help is appreciated.

Scripts: Select an object with a note, duplicating and applying swatch

$
0
0

I am trying to write a Javascript that can do the following:

 

1) Select an object whose note has <Object Name> (so its layers is also selected)

2) Duplicate the layer of that object

3) Rename the new layer to <Layer Name>

4) Apply a swatch to the object on the new layer (the object is only single colour)

5) Apply a new note to the object (over-writing the original note).

 

I also want to write a separate script that can do the following:

1) Select an Object whose note has <Object Name> (so its layer is selected as well)

2) Hide all other layers

3) Save a copy of the document with a specific name

 

I can do this as an Illustrator action. However, I need several different copies of the scripts where the Object Name, Layer Name, Swatch and File Name changes.

Re-recording the action to change the names is cumbersome.

 

I have looked at the Illustrator scripting reference, but cannot see any commands for select objects by their notes.

 

I was wondering if someone could give me some pointers on how to proceed (Or possibly, if feeling very generous, could write the script for me )

Need script to batch convert vector .eps to .png images with scale

$
0
0

Hi,

 

I'm looking for a script/program that if you run it, all the .eps files in a folder will batch convert to a png-24 with 250% scale.

 

Erdem

Exporting to JPEG in CMYK not working (javascript)

$
0
0

Hi all,

 

I'm having a lot of trouble with an .AI script I'm making to export several versions of a file depending on it's color model.

 

The only thing holding me up is that I can't seem to set the color space to CMYK when exporting to JPEG, even though it is possible when choosing File / Export / Export as JPEG (jpg).

 

Here is my function

 

  1. // Exports a JPG 
  2. function exportJPG (filename, resolution, colorspace) { 
  3.  
  4.  
  5.   var options = new ExportOptionsJPEG(); 
  6.   options.antiAliasing = true
  7.   options.artBoardClipping = true
  8.   options.qualitySetting = 100
  9.   options.horizontalScale = (resolution / 72 * 100); 
  10.   options.verticalScale = (resolution / 72 * 100); 
  11.  
  12.  
  13.   if(colorspace === 'cmyk') { 
  14.     $.writeln('color space for JPG is ' + options.imageColorSpace); 
  15.     options.imageColorSpace = ImageColorSpace.CMYK; 
  16.     $.writeln('color space for JPG is now ' + options.imageColorSpace); 
  17.   } 
  18.  
  19.  
  20.   app.activeDocument.exportFile( new File(filename), ExportType.JPEG, options); 

I've got the writeln in there to try to debug, when I run it I get this in the console:

 

color model for JPG is undefined

color space for JPG is now ImageColorSpace.CMYK

 

and I get an RGB jpg.

 

Can anyone help? The scripting reference PDF is really lacking and it doesn't list this property, but it must exist. It would be bizarre if they made the export in scripting more limited than the file menu.

ESTK Data Browser Question

$
0
0

Does anyone know if the scope of the data browser (while stepping through the code) is customizable at all?

By default, it shows the local scope, showing only the variables local to the current function. Is it possible to include inherited variables in the display?

 

Specifically i'm trying to view some JSON of script global scope in the data browser so I can just peruse all the properties rather than writing a loop to display certain props.

 

Thanks in advance,

 

William.

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

SVG 1.2 tiny

$
0
0

I have made the .ai icons (Adobe Illustrator CS3) and they also contain gradient and transparency elements.

Until now I had to provide icons in the SVG 1.1 format (<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN") that allowed me to preserve
the colours and the opacity of the elements. Now I have to provide icons in the SVG 1.2 tiny format or SVG 1.1 tiny (<!DOCTYPE svg PUBLIC "-//W3C//D
TD SVG 1.1 Tiny//EN") but the gradients and the transparent artwork are rasterized.

For the tiny format I tried:

1. Save As > SVG (*.SVG)
SVG Option: SVG Tiny 1.2
And I received the following Adobe Illustrator alert:
"Gradients are rasterised
Transparent artwork is rasterized"
Also it embedded rough .png files (which is unacceptable for my clients, they want only vector, no raster).

2. Save for Web and Services:
SVG > SVG Tiny 1.2
And, in the preview window, the transparency part is changed into opaque.

Is there a plugin, script or other software that I should use?
Please let me know how can I handle this.

Thank you!


Importing Color to Swatch Library from Text File

$
0
0

Hi,

I have a large list of custom colors in Excel that has the color name and CMYK breakdown of each color. I'm looking for a way to import this information to create a custom Color Swatch Library. That will have the name of the color and the CMYK breakdown. So that I can easily use in Illustrator and Photoshop. Is there any way or application in doing this with out manually entering the information and creating a new library?

 

Thanks!

Is it possible to get the items on a specific artboard with script?

script for applying paragraph and character styles in illustrator

$
0
0

0down votefavorite

 

 

I've been trying to manipulate the sample scripts from ADOBE ILLUSTRATOR CC SCRIPTING REFERENCE: JAVASCRIPT without any success (I am brand new to JavaScript). I would like to be able to find specific text in an Illustrator document and apply paragraph and character styles with a script. I would like to be able to automate this feature with a batch for multiple documents.

I can figure out how to apply a style to the whole text box but I would like to be able to search for key words and sentences to apply the styles to.

Help Please! Thanks!

 

 

apple script execute via do script (using javascript).

$
0
0

Hi Scripters,

 

Can you any one please look into this and solve my problem.

My request I want to delete the unused swatches in Illustrator, So that I used the apple script its working fine, the same code i want to execute via do script (java Script).

 

The below Lines I used the Apple script its working fine in the MAC.

After I save as the script file, and app file. I want to execute this from Illustrator using java script but its not working.

 

----------------------

tell application "Adobe Illustrator"

   activate

   tell current document

     do script "Delete Unused Panel Items" from "Default Actions" without dialogs

   end tell

  end tell

--------------------

 

 

var mege_excel = File(getScriptPath().parent+ "/ILLUS.scpt");

app.doScript(mege_excel, ScriptLanguage.applescriptLanguage);

 

function getScriptPath() {

  try {

        return app.activeScript;

        }catch(e) {

            return File(e.fileName);

            }

        }

 

thx,

csm_phil

Script to convert CMYK color to PMS color

$
0
0

Hello All,

 

I have bunch of AI files that have thousands of objects with all different CMYK colors.

What I need to do is converting them into Pantone solid coated (PMS) colors.

 

I found a free script showing equivalent pantone color from the link blow.

10 Free and Extremely Useful Illustrator Scripts - Vectips

 

And trying to tweak to make the pantone color to be applied to the selected object.

In below script, I added line 178 and 179 like below.

 

activeDocument.selection[0].fillColor.typename = "SpotColor";
activeDocument.selection[0].fillColor.color = matchlist[0];

 

But it doesn't change the object's color.

Could you let me know how to do this?

 

I am not sure how to add script in this forum. Please download JS code from the link below.

https://www.dropbox.com/sh/qdxo1pi482h6yyx/AACeeo-ko6-ZPlzwfzpjZZQaa?dl=0

 

I am kind of new to scripting and wondering how to make this work.

If anyone can give me some advice, it would be great.

 

Thank you.

Viewing all 12845 articles
Browse latest View live


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