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

Page numbers in illustrator

$
0
0

Hi,

I have the script for inserting page numbers in Illustrator, but the problem

I face is there are 2 files of about 50 pages each. The first file I can insert

the page numbers from 1-50, but the second file, am not able to insert

from 51 onwards, need help on this please. thanks

 

felix


Saving PDF - Hi and Lo res - JSX

$
0
0

Hi all,

 

I've been trying to figure this out but to no avail. Basically I want to save a Hi and Lo res PDF of an ai file using a script. I've done some searching around on the forum and come across this script. The problem I have is that the 2 PDFs produced are both the same size. I want one to be compressed and one to be Hi res. Where am I going wrong? Below is the script I'm using.

 

#target illustrator

#targetengine "main"

 

for (x=0;x<app.documents.length;x++)

{

     var workingDoc = app.documents[x];

     var workingDocFile = workingDoc.fullName;

 

// populate these with your settings

     var lowResOpts = new PDFSaveOptions();

     lowResOpts.colorDownsampling = 150

     var lowResOpts = new PDFSaveOptions();

     lowResOpts.compressArt = true

     var highResOpts = new PDFSaveOptions();

 

     var lowResFile = new File(workingDocFile.toString().replace(".ai","_LR.pdf"));

     workingDoc.saveAs(lowResFile,lowResOpts);

 

     var highResFile = new File(workingDocFile.toString().replace(".ai","_HR.pdf"));

     workingDoc.saveAs(highResFile,highResOpts);

 

     workingDoc.close(SaveOptions.DONOTSAVECHANGES);

 

}

 

Thanks in advance!

creating outlines from text using javascript in Illustrator CS5

$
0
0

Hi everyone,

 

Is there a way to select all of the text on all artboards and CREATE OUTLINES using Javascript? I've googled and googled, but I can't seem to find any help. The text that Adobe provides for scripting has this option for saving to FXGs which is preserveTextPolicy or something similar, but I need the same type of solution for saving as an AI file or as a command before the save. I'm currently working in windows, but am writing this script for use on a MAC. If there isn't an internal way of doing this through Javascript, does anyone know of another?  I would imagine it would be possible through Applescript since it can access the application's GUI, but I'm not sure. A javascript solution would be preferable, but any solution would work at this point.

 

thanks,

Matt

Convert to Grayscale

$
0
0

Hello,

 

It is possible to apply the Convert to Grayscale(Edit->Edit Colors->Convert to Grayscale) for the selected items in illustrator cs3 in script (javascript)?

Kindly advice me the possiblities.

 

I'm a begginer I hope somebody help me

Thanks a lot

Florin

Illustrator error occurred: 1346458189 ('PARM')

$
0
0

I'm so sick of these errors,

never had an issue before CC

anyone know what is causing these errors?

 

have been using this script all day and now it bugs out on me.

error2.JPG

full script is below:

var doc = app.activeDocument;
var sel = doc.selection;
var TOmm = 2.83466796875;
Dim(sel);
function Dim(objs) {    for (var i=objs.length-1;i>=0;i--) { // loop through your collection of objects        var bounds = objs[i].visibleBounds; // Get visibal bounds, which are only visable bounds in some cases...        var b1 = bounds[0] /TOmm;         var b2 = bounds[1] /TOmm;        var b3 = bounds[2] /TOmm;        var b4 = bounds[3] /TOmm;        var W = Math.abs(b3-b1).toFixed(1);        var H = Math.abs(b4-b2).toFixed(1);        var txt = doc.textFrames.add(); // Create the text frame        txt.contents = "Size:  "+ H + " x " +W + " mm W";  // Adds contents to frame        txt.position = [objs[i].left,objs[i].top - objs[i].height - 20]; // Positions the frame  };   
};

 

Am I missing something in the quality of the Code?

How to change the font of only numbers in a textframe?

$
0
0

I'm working to create a script that makes a textbox based on user input. I need a way to make it so any time a number is used, it uses a different font.

 

Here's what I'm working with so far

        var doc = app.activeDocument;

        var pItems = doc.activeLayer.pageItems;

        var text_frame_boxed =  doc.activeLayer.textFrames.add();

        text_frame_boxed.contents = text_box_text.text;

        text_frame_boxed.textRange.characterAttributes.size = font_size_letters; 

        text_frame_boxed.textRange.characterAttributes.textFont = app.textFonts.getByName(font_for_letters);

 

I need to search the contents for any numbers, and replace their characterAttributes (both size and textFont).

Convert string (string of JSON) to JSON object?

$
0
0

**EDIT**

I finally figured out how to use #include instead of file.read();. This solves my immediate problem. However I am still curious as to whether it's possible to do what I'm asking for below, just in case there comes a situation where for whatever reason I cannot simply use #include. Thanks everyone. =)

**EDIT**

 

**EDIT 2**

Anyone know how to use #include for a file whose name is determined during script execution?

For example.. the variable orderNumber is generated by a prompt window (lets say the result is 1234567). the file i want to include will be named "1234567.js).

What I want to do is something like:

#include "~/Desktop/Info Folder/" + orderNumber + ".js"

(then I want to assign a variable to the result somehow, since it's simply an anonymous object at this point and i don't know how to access it's contents);

**EDIT 2**

 

Hey all. I have a (most likely really stupid) question about how to take a string that contains the JSON text and simply change it's type from "string" to "object"... I'm probably wording this very badly.

 

I'm fetching a .js file from my local network and setting a variable to the result of file.read();

 

The contents of the file is an anonymous object in JSON. However, when i use file.read(); the object is brought in as a string, like this:

 

'{"roster":[{"name":"Fink","number":"19","jerseySize":"XL","qty":"1","topId":"78531"},{thi s is the next player},{this is the next player}]}'

 

That is a massively simplified version of what i'm actually reading, but you get the point. I want to be able to bring that object into the script that I'm running and create new objects based on the pertinent information (in this case i only need the values for "name", "number", and "jerseySize").

 

So my question is this. how do i turn the above string of JSON into:

 

var roster = [

     {

     "name":"Fink",

     "number":"19",

     "jerseySize":"XL"},

     {

     next player

     },

     {

     next player

     }

]

 

???? A google search reveals the method JSON.parse(text). But that is not supported in ESTK.

Script to round fractional CMYK colours?

$
0
0

This script must exist but I'll be damned if I can find it!!!

 

I work in a large printing company and we get artwork from all over that has dodgy CMYK colours (quick convertions from RGB obviously). We have noticed that these colours don't rip as well as rounded CMYK colours, so we spend a lot of time cleaning them up and rounding them down...

 

I'd like to be able to just run a script that does this to a whole document, including the colours inside gradients. So if for example the number is .5 or below we round down, or above we round up.

 

Does this exist, does anyone know?

 

CHEERS!

S


Split Text into Layers

$
0
0

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

How to create outlines?

$
0
0

I want to create outline for all TextFrame

Here is my code:

 

  1. app.executeMenuCommand("Text Objects menu item");
  2. app.executeMenuCommand("Create outlines menu item"); // This is a failure here

 

What parameters should I use here?

Unable to select same Graphic style on pasted eps

$
0
0

I open an eps.

Copy the whole graphic.

Open correct template and paste copied graphic.

The template has Graphic styles with same fill and stroke (no other attributes exist) as in pasted graphic.

However, I cannot select elements in pasted graphic based on Graphic Style even though pasted graphic contains elements with same stroke and fill.

I cannot select on same stroke and fill either.

 

I checked Document Colour Mode and made sure it was RGB Color.

However, when I select the element and double click Color Picker the initial window is showing New Color 1100 so I suspect even though the same style illustrator is assigning the element color and stroke as new.

 

This selection process is a step in an action for applying styles and has worked - then it doesn't.

 

Probably something simple is changing parameters but appreciate suggestions as to where the issue might lie.

 

This is old CS2 on Mac PPC G5 but still pays for itself doing simple processing of output files.

 

Any advice appreciated as many hours trying to figure this out.

 

Thank you

 

Michael

Automated exports PRINT PDF, EPS, AI + WEB PDF

$
0
0

Hi.

 

I yet have not found a way to automate the following in 1 Batch:

 

1. Embed all links

2. Text to paths

3. Export PRINT PDF (Preset)

4. Export PRINT EPS

5. Change Path Text back to text

6. Export AI with embedded links, normal text

7. Export Web PDF

8. Close / Do not save

 

Is there any way to embed links within an AI Document (each document has its own links, never the same), and change text to paths and back (3 steps later)?

Until today I embed links, set text to paths, then export Print PDF and EPS by action, then press cmd+z :-) and get another action running for the rest.

 

Is there a function I do not see?

 

Thanks in advance!

SaveAs under Windows errs with 'The file may be read-only'

$
0
0

1. I have a new (untitled) document

2. My scripts tries to perform 'SaveAs(filepath)'

3. A error popup appears "The file may be raed-only, or another user may have it open. Please save the document with a different name or in a different folder."

 

When I use the EXACT SAME filepath, and go manually to the menu - SaveAs, and paste the file path there, it works perfectly.

 

I'm 100% sure that the given filepath does not exist before the script runs.

 

We can't back-check right now, but the same script worked fine in Illustrator CC 2018, is that possible?

 

Again, it just happens on Windows!

 

Best regards,

Stefan

VBScript Rookie

$
0
0

Hello Guys/Gals,

 

I'm a quadriplegic male aspiring to all things geeky :-)

 

I have just started my adventure with Illustrator CS6, loving it so far…

 

I have wandered into the woods a.k.a. Gradient Mesh Tool… And here I thought the pen tool was Awesome

 

I have played around with the actions features in Photoshop… I was even brave enough to record and use a couple of my own actions. Makes it much easier for the repetitiveness.

Back to illustrator though…

 

I use the human face is an example…

 

I will use the pen tool with no stroke and now fill to make an outline around my subjects pupil…

Then I will go to the menu and click on "Object" >Create Gradient Mesh (depending on what I am outlining, I will adjust the amount of rows and columns accordingly)…

 

then comes the ultra long boring process of using the direct selection tool and selecting one anchor point at a time, then switching to the eyedropper tool and selecting the color beneath it (the color beneath the selected anchor point)…

 

Just to make things clear, I make sure I'm in outline mode/view…

 

This is where a VBScript would come in most handy…

 

By selecting all the anchor points at the same time if possible and then coloring the anchor points that is below the mesh outline…

 

I have written a few very simple console applications in C#, but… VBScript's keywords, statements & functions are a bit different…

 

If somebody could help me out with the repetitive part of selecting anchor points and coloring them, that would be most appreciated…

 

Thank you in advance to anybody that would help.

 

Rob

Script that gives specific names to layers - from bottom to the top

$
0
0

Hi,

 

This is probably an easy one for anyone with JavaScript experience.

I have 35 layers that I want to give specific names to (now they're named liked "layer 1, 2, 3" - but sometimes this won't be consistent, so some numbering might be skipped,

in other words I can't rely on a script that renames a specific "Layer 1" to "my name").

 

I want to rename each layer from the bottom to the top, i.e.:

[...]

"Power"

"Yellow"

"Hello"

 

With the script working its way up from the bottom to the top.

How do I accomplish this?

 

Thank you so much for you taking your time to help me.


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!

Replace color via swatches

$
0
0

Hi,

 

I just need to find objects, texts or anything in page have spot color value of C=0 M=0 Y=0 K=100 into "Black" color.

The below is the tried coding, it is not finding  "Black" color in swatch list.


var doc = app.activeDocument;  
var item = doc.pageItems;  
var col = doc.swatches.getByName('Black');      
for(var i=0; i<item.length; i++){           if(item[i].fillColor.spot.color.cyan == 0 && item[i].fillColor.spot.color.magenta == 0 && item[i].fillColor.spot.color.yellow == 0 && item[i].fillColor.spot.color.black == 100){                  item[i].fillColor.spot.color == col;}     }



Not sure why it is not applying. It is doing fine if the color is in process mode.

 

if(item[i].fillColor.cyan == 0 && item[i].fillColor.magenta == 0 && item[i].fillColor.yellow == 0 && item[i].fillColor.black == 100){               item[i].fillColor == col;}  

 

Thanks,

Karthi

URGENT: Please help to get correct outputIntentProfile

$
0
0

Hi,

 

I need to get the following profile name when i save an .ai file to .pdf.

 

Screen Shot 2016-01-22 at 12.01.07 PM.png

 

Below is the tried coding.

 

var workingDoc = app.activeDocument;
var workingDocFile = app.activeDocument.fullName;
var highResOpts = new PDFSaveOptions();      highResOpts.pDFPreset = "Hi-Res NC";        highResOpts.colorConversionID = ColorConversion.COLORCONVERSIONTODEST;         highResOpts.colorDestinationID = ColorDestination.COLORDESTINATIONWORKINGCMYK;          highResOpts.outputIntentProfile="GRACoL2006_Coated1v2.icc"      highResOpts.viewAfterSaving = true;      
if (( workingDoc.fullName.toString().substr(workingDoc.fullName.toString().lastIndexOf('.')) == ".ai" ) || ( workingDoc.fullName.toString().substr(workingDoc.fullName.toString().lastIndexOf('.')) == ".eps" )){       //Make sure your working with an ai file          var highResFile = new File(workingDoc.fullName.toString().substr(0,workingDoc.fullName.toString().lastIndexOf('.')) + "_HR.pdf");          workingDoc.saveAs(highResFile,highResOpts);    workingDoc.close(SaveOptions.DONOTSAVECHANGES);    }

 

 

Even i set the profile with pdf preset it is not coming as desired.

 

Please help me to sort out this problem.

 

Thanks,

Karthi

Script. Insert text number in the middle of visible bounds of the each object

$
0
0

Hello! Adobe Illustrator CS 6

I have script, wich groups filled paths by colors. Link to script and traced image. Traced_image.rar - Google Drive

I have traced image, it has 25 colors. The script creates 25 groups, paths of each color in each group.

I need to modify script, i want to insert text number in visible middle of the each filled path. So one group is one number. From 1 to 25.

Can anyone help me?

How delete a Action Set in Illustrator by Script?

$
0
0

this my code Load and unload a Action in Illustrator. But Action Set [Test_Set_Action] still exist after unload .

oIllustrator.loadAction("C:\Test_Set_Action.aia")

oIllustrator.unloadAction("Test_Set_Action", "CVCMYK")

How delete a Action Set [Test_Set_Action] after unload by Script?

Or check [Test_Set_Action]  still exist?

Viewing all 12845 articles
Browse latest View live


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