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

Excel data to construct illustrator object

$
0
0

Problem:

How to read real number data from selected columns in an Excel spreadsheet into an illustrator javascript array variable, so that then I can use this information to construct an illustrator polygon. 

 

Further information:

I am new to javascript (and not much of a programmer in the best case, but do have some basic knowledge using ancient languages like FORTRAN 88). I am sure I am just missing an important step here despite all morning browsing with Google for answers (something to do with variable definition I assume?). I have some survey data defining the outline of features in map view listed in a string of point (x,y) values in adjacent columns in excel (these x,y point values calculated from GPS data using a commercial program to converted 3D position to a 2D x,y by geoid projection, and then in excel to re-scale point locations to illustrator’s artboard).  What I am trying to do is select columns of x,y value pairs in an excel spreadsheet, copy these values to the clipboard, and then develop an IA JavaScript to draw a polygon through the specified set of x,y points. It seems easy enough to script illustrator to draw the polygon once I get the values from the clipboard are in a javascript array (lots a good tips here http://scriptographer.org/tutorials/), but pulling in the clipboard data seems to be beyond me. I have tried populating a defined array with various combinations of array declarations and app.paste(); or windows.clipboardData.getData('text/plain'); with no satisfaction. I then had the idea to try to pull in the clipboard to one long continuous string, place that in a text box (see see its structure), andthen read and split up the text in a loop to populate the JavaScript array…but that deposited a complex illustrator table object into my text box, and several attempts to force the clipboard to paste text did not work (again probably having problems understanding variable type declaration).

 

Thanks very much for any suggests….and to be clear, I would be happy to find any method of scripting the pull of the selected on an excel spreadsheet for use in an Illustrator script…so if I am making this all harder than it needs, be I would be grateful to know that also!


Resolution check in illustrator

$
0
0

How to check the raster image resolution in illustrator through script?

ExportType.SVG "Use Artboards" option

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.

Is batch resizing possible in Illustrator?

$
0
0

I have over 1000 ai files to be resized. Is there a script to do this in batch? Thank you!

Mail merge using illustrator

$
0
0

Hi There,

 

I'm trying to find a way to automatically populate data into Illustrator and InDesign.  I was thinking of doing it using Applescript and importing an excel file into an illustrator graph object.  My boss suggested i look into using Xtags as a means to do a data merge with the illustrator/indesign files.  Is this possible? it seems that xtag is a format used with Quark.  is it also available in Adobe products?

 

Thanks,

 

(sorry if my terminology is off, i'm a programmer so my knowledge of adobe design products is limited)

Is it possible to script a tabbed ui?

$
0
0

Is it possible to script a tabbed ui like this, i can't seem to get it to work, please help...

 

Cheers Daniel.

 

 

My script for now:

 

#target illustrator

tabbed_ui();

 

//Functions

function tabbed_ui(){

   

    res =

    "dialog {text:'Adres database:', properties:{resizeable:false }, \

        maintabpanel: TabbedPanel { text:'', \

            subtab1panel: Tab { text:'Tab1', \

            }, \

            subtab2panel: Tab { text:'Tab2', \

            }, \

        }, \

    }";

   

    wininfo = new Window (res);

    wininfo.frameLocation = [100, 100];

    wininfo.margins = 0;

   

    // Control Escape key

    wininfo.addEventListener('keydown', function (k) { 

        if (k.keyName == 'Escape') {

            wininfo.close();

        }

    });

 

    wininfo.center();

    wininfo.show();

};

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


Relink many files at once

$
0
0

I was wondering if anyone can help.  I'm using Illustrator CS6.  I have an artboard with 200 of the same placed file.  I now want to use this same layout for 30 other views, they are the same size, but different images.  If I relink them I have to click through each one.  I tried using a script I found on here by Carlos:

 

#target Illustrator

 

// script.name = relinkAllSelected.jsx;

// script.description = relinks all selected placed images at once;

// script.required = select at least one linked image before running;

// script.parent = CarlosCanto // 7/12/11;

// script.elegant = false;

 

var idoc = app.activeDocument;

sel = idoc.selection;

if (sel.length>0)

     {

        

          for (i=0 ; i<sel.length ; i++ )

               {

                   if (sel[i].typename == "PlacedItem")

                        {

     

                            var iplaced = sel[i];

       var file = File.openDialog ("open file " + iplaced.file );

                            iplaced.file = file;

                         }

               }

     }

else

     {

          alert("select at least one placed item before running");

     }

 

 

 

 

 

 

and I get an

 

error 25:  Expected: }.

Line:10

->  p.p1 {margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Times}

 

Any Ideas?  I'm on a mac, os x 10.6.8.  and I copied the script into the script preset folder so its starting  from the drop down menu.  Don't think I'm leaving anything out.  I'm swapping 1 placed(linked) PDF for another.

 

 

Thanks

Marcus

Anything similar to javascript's setInterval in ExtendScript?

$
0
0

I need a way to poll my server for new jobs for the illustrator script to work on every few hours.

I tried with $.sleep(), but that is blocking, I need a non-blocking way to do this.

Any advice?

 

Thanks!

Kashmira

How to automate the flatten transparency in illustrator?

$
0
0

How to automate the "Flatten Transparency option" in illustrator via javascript. Please share with me.

 

Thanks

Change font in Illustrator cs4 js

$
0
0

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

AppleScript moving certain colours to new layers

$
0
0

Hi all. This is my first question here. I'm attempting to use AppleScript to organize the layers of my art files.

 

What I am looking to do is have all objects with a fill color that is a specific CMYK value moved to a new layer. I don't know enough about how AppleScript and Illustrator's scripting interface works to make this function.

 

In my mind, I want to write something like this:

select all objects with fill color CMYK:100,80,0,0

move selection to Layer 2

 

AppleScripts always seem to be far more complicated than I initially envision them. Any thoughts on how this might actually be written?

 

Thanks so much.

David

Script works Great, Pro-Tips appreciated.

$
0
0

This script is used to make a few changes that SOME of our die suppliers require. It works great. If you have a little time to look it over and give me some advice on best practices, consiseness etc. it would be greatly appreciated.

 

Note: The files this script is aimed at are fairly civilized, and don't vary much so I didn't have to buld in room for varience. For example, the die lines will ALWAYS be a spot color, so I didn't need to include anything for RGB or CMYK.

 

 

// script.name = prepDieFile.js;
// script.description = removes unnecessary layers, vectors, and text. Leaves cross-mark line unpainted. Colors all remaining text and strokes black;
// script.requirements = an opened document;
// script.parent = elDudereno // 10/10/13;
// script.elegant = false;


#target Illustrator


var idoc = app.activeDocument;
var pi = idoc.pathItems;
var tf = idoc.textFrames;
var deletedLayers = 0;
var deletedPaths = 0;
var spotStroke = 0;
var deletedText = 0;
var blackedText = 0;


var layerCount = idoc.layers.length;
//loop through all layers deleting hidden layers. Loop from the back, to preserve index of remaining layers when we remove one.
for (var i = layerCount - 1; i >= 0; i--) {          var thisLayer = idoc.layers[i];          if (thisLayer.visible == false || thisLayer.locked == true) {                    thisLayer.visible = true;                    thisLayer.locked = false;                    thisLayer.remove();                    deletedLayers++;          }
}


unlockPaths();


//locate largest path item (bounding box) and lock it.
var theBiggest = pi[0];
for (i=1; i<pi.length; i++) {          if (Math.abs(pi[i].area) > Math.abs(theBiggest.area)) {                    theBiggest = pi[i];          }
}
theBiggest.remove();
deletedLayers++;
//locate second largest path (cross-mark size) remove stroke and lock
var secondBiggest = pi[0];
for (j=1; j<pi.length; j++) {          if (Math.abs(pi[j].area) > Math.abs(secondBiggest.area)) {                    secondBiggest = pi[j];          }
}
secondBiggest.strokeColor = NoColor;
secondBiggest.fillColor = NoColor;
secondBiggest.locked = true;


// loop through path items delete if hidden, registration, or un-stroked. Change all non-registration spot colors to 100% GrayColor.
for (var j=pi.length -1; j >= 0; j--) {          var ipath = pi[j];          if (ipath.hidden==true) {                    ipath.remove();                    deletedPaths++;          }          if (ipath.locked==false) {                    var strokeColor = ipath.strokeColor;                    if (strokeColor.typename == "NoColor"){                              ipath.remove();                              deletedPaths++;                    }                    else if (strokeColor.typename == "SpotColor"){                              if (strokeColor.spot.name == "[Registration]"){                                        ipath.remove();                                        deletedPaths++;                              } else {                                        ipath.strokeColor = GrayColor;                                        ipath.strokeColor.gray = 100.0;                                        spotStroke++;                              }                    }          }
}
unlockPaths();


// delete text frames with first letter set to registration. Turn all other text to black.
for (t=tf.length -1; t>=0; t--) {          var iTxtFrm = tf[t];          var firstLtr = iTxtFrm.characters[0];          if (firstLtr.characterAttributes.fillColor.spot.name == "[Registration]"){                    iTxtFrm.remove();                    deletedText++;          }          else {                    var chars = iTxtFrm.characters;                    for (var c=0; c<chars.length; c++) {                              var ltr = chars[c];                              ltr.characterAttributes.fillColor = GrayColor;                              ltr.characterAttributes.fillColor.gray = 100.0;                              blackedText++;                    }          }
}


redraw();


alert(deletedLayers + " hidden or locked layer(s), " + deletedPaths + " path(s) & " + deletedText + " text frames, were deleted.  " + blackedText + " letters, & " + spotStroke + " stroke(s) were converted to 100% K.");


//unlock all path items
function unlockPaths(){
          for (var k=0; k<pi.length; k++){                    var lpath = pi[k];                    if (lpath.locked == true){                              lpath.locked = false;                    }          }
}

 

Thanks for taking a look.

 

http://www.filedropper.com/0388701die<-sample file.

Move layers to new artboard

$
0
0

Hi everybody,

 

I'm trying to create a script via javascript for Illustrator.

 

My problem is :

I have a AI file with multiple layers, i want to create one artboard per layer, in order to export a multipage PDF ( each page contain 1 layer ).

 

The layers represents the differents type of print ( vernish, color, hot gold, pressure ... ) and/or color type ( Pantone, CMYK, cut, kisscut ... ).

My client want a PDF for see each type of print or color type per page.

 

I'm trying 2 ways :

 

1st solution : Create new artboards, and duplicate ( or move ) layers content on the new artboad, but the function move/duplicate don't work to move content on another artboard.

 

2nd solution : Create new document with the same number of layers as artboard and duplicate layer to the new artboard on the new document.

 

Can you help me to realize this script ?

 

Excuse me if my english is not good.


Select All using AppleScript

$
0
0
I saw the posting for selecting all objects using JavaScript. How do you do this with AppleScript?

Convert .ai to .doc

$
0
0

Hi,

 

Can it be possible to convert .ai file into .doc file or any tool which will do this conversion.

 

Thanks,

Shail

Cutting a circle

$
0
0

Hi all,

 

I need to make shapes like this based on a value for graph purposes - usually I would just create a cutting shape based on trig (this shape representing around 60%) and subtract it from the path - I have about 30 graphs to do and I need to base it on a variable, and I want to use script - I'm sure there must be a better way, and I'm hoping you guys have the answer.

 

Thanks in advance

 

Dave

cut.png

UI (Window, dialog, palette etc) reference info for AI scripting

$
0
0

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.

Relative file path/folder (AppleScript)

$
0
0

How do I set a folder as a realtive path to where the script is running??  

is there any easy way like in unix, starting without / ?

or for example

 

"~/Desktop/"

 

"/users/<login>/desktop/"

 

seems that path to me is the only way...

 

is there an easy way to change posix paths to applescript??

 

I have this code:

 

tell application "Finder" to set templateFile to (container of (path to me) as string) & "Graficas FINAL ADQAT.ai"

 

with this error:

error "No se ha encontrado el archivo Macintosh HD:Users:Vibra:Desktop:Graficas FINAL ADQAT.ai." number -43 from "Macintosh HD:Users:Vibra:Desktop:Graficas FINAL ADQAT.ai"

 

the file is there how I change the filepath to be compatible with applescript??

Viewing all 12845 articles
Browse latest View live


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