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

Pg Number, File path and date automatically printed?

$
0
0

Is there a way to automatically print the page number, complete file path and date at bottom of each  page (set to landscape)?

 

Thanks!


Script for closing the open paths on Illustrator CC2015

$
0
0

Can someone give me a script to close all the open paths on Illustrator CC2015 ?  Thanks.

How to export a selection?

$
0
0

Hi!

 

I looked at the scripting documentation about the ExtendScript API and can't find anything.

 

Do you know how to export a selection?

 

The "exportFile" is working fine for a document but there is no option for the selection

exportFile(svgFile, ExportType.SVG, exportOptions);

 

I want to do the same thing as within the menu (but without the dialogs)

Screenshot 2017-02-16 at 17.59.30.png

 

I also found that some people are duplicating the selection on another document and exporting it, but in my case this process is too "heavy", you see things opening / moving / closing and it's blocking the UI, that's is not possible for us as we are doing an Illustrator extension.

 

Thank you!

Transform Each

$
0
0

Hi all,

 

i'm working on a script and final step is missing, i just want to know Transform each function code on JavaScript, or at least i want to create a code can do a shortcut like (Alt+Ctrl+Shift+D)

 

 

Object > Transform > Transform Each with Reflect X and Center point position

 

image.png

 

 

7.png

 

 

is it possible??

 

 

Thanks a lot

 

Script for Selecting Open Paths in Illustrator CS6

$
0
0

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");
}

Undefined PDF Presets in Illustrator CS5

$
0
0

I'm encountering a problem when attempting to retrieve a list of PDF preset names in both AppleScript and JavaScript. Here are the steps I'm performing:

 

1) Launch Illustrator

 

2) Run the following AppleScript:

 

     tell application "Adobe Illustrator"

          PDF presets

     end tell

 

or JavaScript:

 

     app.PDFPresetsList;

 

When I run the AppleScript, I receive an error: "Adobe Illustrator got an error: an Illustrator error occurred: 1128353350 ('FNAC')" number 1200.  (Sometimes, 'ACVI' is listed instead of 'FNAC'.)

 

When I run the JavaScript, I receive: "Result: undefined"

 

If I retrieve Illustrator's properties via AppleScript, I can see that the PDF presets property appears as 'missing value'.

 

The only workaround I've found is to manually go to Illustrator and choose "Edit > Adobe PDF Presets", and then immediately click "OK" to close the window.  Whatever this does seems to fix the problem, and if I run the scripts again, they produce the correct results until Illustrator is relaunched, at which time the problem begins again.  I'm wondering if anyone else is experiencing this, and if anyone has come up with any other workarounds, preferably one that doesn't require manual work.

 

Much appreciated.

 

-Ben

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.

More complex pie charts

$
0
0

Hi,
I'd like to create improved pie charts with effects like this without doing them by hand :

 

 

Sans titre - 1.png

I'm bad at scripting in illustrator, but I'd like some effects like the slice's size variations and the text orientation.


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

Changes in CS6

$
0
0

OMG! the CS6 DOM additions are _________. (fill in the blanks).

 

2 Enumerations

- Compatibility.ILLUSTRATOR16

- ExportType.TIFF

 

2 Methods

- PlacedItem.relink()

- Application.sendScriptMessage()

 

1 Data Class

- ExportOptionsTIFF

 

 

(According to the CS6 SCRIPTING REFERENCE)

script to align selected objects to artboard

$
0
0

Hello, I was wondering if anyone had a simple solution to aligning selected items to the artboard. I was going to create an action but then realized it would be more convenient for me to include it in my script file....I have a script to align objects with each other but they dont align to the artboard. Any suggestions?

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.

Coloring map from data sheet like excel

$
0
0

Hello

 

Is there a way to color a map from data sheet like excel? I'm thinking of splitting a country into regions and bind the paths to a variable that can be change by importing a data sheet.

 

Has anyone here got experience with this?

Change Folder.current to location of script (.jsx) file?

$
0
0

All,

 

I'm trying to use some images in my ScriptUI dialog, but I want to use a "relative" path name, and I can't seem to get it to work.

For example, this myScript.jsx works just fine, but as you can see, I'm using an "absolute" path name to transparencyGrid.jpg:

 

var w = new Window ("dialog");
var f = new File ('~/Desktop/transparencyGrid.jpg');
w.add ("image", undefined, f);
w.show ();

 

However, I want to be able to use a relative (to myScript.jsx) path to point at transparencyGrid.jpg, like this:

 

var w = new Window ("dialog");
var f = new File ('../../../transparencyGrid.jpg');
w.add ("image", undefined, f);
w.show ();

 

But, I can't seem to get this to work because relative paths seem to be relative to the current folder, Folder.current, not the location of the currently executing script.

I say that because when I do this:

 

alert(Folder.current);

 

The only thing the alert message shows is a backslash (/), indicating to me that the current folder is the root of my OS, but I thought it would be the folder where myScript.jsx resides.

 

So, is there a way of setting Folder.current to the location of the actual script?

Swap symbol instance by changing its name?

$
0
0

Hello all

 

I'm trying to swap symbols in situ by changing the 'name' property of the symbol instance.

 

My rudimentary script can find the existing symbol name (for me, that's a small triumph!). The Illustrator document has two symbols in the Symbols panel, 'blue_square' and 'red_circle'. I run the script with an instance of 'blue_square' (and nothing else) on the page, and try to change the name to 'red_circle':

 

var docRef = activeDocument;

 

var symbolitem = docRef.symbolItems[0]

 

var symbolname = symbolitem.symbol.name;

 

var newname = "red_circle";

 

symbolitem.selected = true;

 

// this next line causes the problem:

symbolitem.symbol.name = newname;

 

This causes an error - 'the name is in use'. Could someone please tell me where I'm mistaken?

 

Many thanks for your interest.


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

Script for Copy and Paste Object from one Ai file to another Ai file.

$
0
0

Is it possible to create script that will take object (Text and Images) form one and AI file and placed them into another AI file in specific layer and location?

 

When I do it manually:

 

#1 - Create Banner Design (Text and Images)

# 2 - Outline the text and group it with images to make it one object.

# 3 - Copy the group object

# 4 - Open another Ai file

# 5 - Paste it into specific layer and adjust location

 

We do this to individually customize documents and it is very time consuming.

 

Feel free to contact me directly, we will consider to hire programer to help us.

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

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)?

Restart illustrator through script (or eliminate PARM error)

$
0
0

I'm working on a javascript that goes through a folder, rasterizes the paths inside each file, and saves the results as separate files in another folder. My script works fine on individual files as well as for several simple files. However, once it gets going on some of the big ones, it starts to give me PARM errors.

 

What I'm working with:

  • Illustrator CS5.1
  • Windows XP, SP3 (work computer)
  • Javascript
  • The CAD export that created the pdf and eps files broke any curves into tons of tiny straight lines. As a result, these drawings can have 15-35 thousand paths per image.

 

Summary of my code:

  • Get the source and destination directories
  • Open a file from the source directory
  • Go to the first layer of the file
  • Loop through all text items to move them to their own layer
  • Loop through all path and compound paths to move them to a group
  • Rasterize the group of path items
  • Repeat for the next layer and so on
  • Save the file to the destination directory
  • Repeat the process for the next file and so on

 

The scripting guide suggests it could be from conflicting functions or global variables overwriting each other. However, my script is now entirely contained within its own function, and all variables are declared locally. Running from a clean illustrator and ESTK startup, it will still produce a PARM error after a few large files.

 

The guide also suggests having the script quit and re-launch Illustrator after working on many files. Since I assume these huge diagrams are probably several "normal" files' worth of objects each, I figured it probably just needs to restart Illustrator after x amount of stuff goes through. So I look in the guide's section on launching Illustrator through javascript. That basically says "Why would you ever need to do that?" Gee, thanks. I tried looking it up in the tools guide, but that document isn't very clear at all.

 

 

So, onto my actual questions:

 

1. What would I have to do so Illustrator doesn't throw a PARM error on the line marked below? (besides just putting it in a try/catch and pretending it didn't happen) It doesn't consistently happen on the same file or even at the same point in the file, but always at that line.

 

This is just a tiny part of the script. objectClass is a placeholder for PathItems, CompoundPathItems, etc. Looping backwards and setting the group to null at the end were just experiments, neither of which had any effect on the error.

 

if(objectClass.length > 0){    var objectGroup = myLayer.groupItems.add();    for(var i = objectClass.length; i > 0; i--){        objectClass[i-1].move(objectGroup, ElementPlacement.PLACEATBEGINNING); //This one keeps breaking stuff.    }    sourceDoc.rasterize(objectGroup, rastBounds, rastOptions);    objectGroup = null;
}

 

 

 

2. Failing that, how can I relaunch Illustrator through javascript? Or a limited amount of VBScript, though my knowledge of that is limited too.

Viewing all 12845 articles
Browse latest View live


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