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

script file(.js) for simplify the path points..............

$
0
0

I am using Illustrator CC 2015 version ,When I am loading any dxf or pdf file in Illustrator ,it is

showing too many points.

For removing these unused points, I am using the menu Object --> Path --> Simplify options.

After changing some values of simplify path option , It removes the unused points.

These points are given below it's showing the before apply the Simplify and after apply the simplify option. 

simplify.png

I want to the Script file (java script ) OR  code for this Simplfy options.

So Please assist me.

Regards

Kundan


applescrpt illus cs4 - how to "rasterize" a selection of placed items

$
0
0

Could use some help with applescript/ illustrator CS4.. .

 

I need to select all images on a page and apply the object > rasterize command.

 

so far i have

 

    set allGraphics to every placed item of document 1

 

but can't figure out the right command to rasterize (including setting certain options.)

 

any help is appreciated!

 

thanks

Add image link filename to each artboard

$
0
0

Hello everyone!

 

I have a document with several artboards. In each artboard is a different linked image. Is there a way to add the linked filename to the bottom of each artboard? Thank you!

Delete/Remove/Overwrite files/folders while saving

$
0
0

Hello again.

 

I am finishing up a simple script similar to one you've probably seen and more than likely used before (multiexporter.jsx by Tom Byrne). My production department has requested that we give them a single PDF per artboard in the document with specific export settings and a proper file-name (based on the name of the artboard).

 

i've written a loop to save out each artboard with all the right settings.. but now i'm running into the problem of duplicates. It's very likely that I will have many duplicate artboard names, but they all need to be saved. By default, the files are overwritten by the subsequent save function. I got past that by adding a sort of sequence number to the end of the filename if a duplicate is found.

 

The problem now, is that I would like the script to run correctly regardless of whether the destination folder exists or not. For example, I've already run the script and saved my .ai file and all the PDFs. Now i realize that i needed to make a change to the file and re-save (via the script) and overwrite the files i saved there the first time. Unfortunately, because of the sequence numbers i talked about above, i get all the old files as well as all the new files in the folder.

 

My first thought was to delete the existing destination folder and re-create it. However, it looks like Javascript cannot do that. Will i just have to tell my artists they must manually delete their folder before they re-run the script? or is there a way to overwrite the folder while still maintaining the sequencing for duplicate files inside the folder??

 

Here's the code:

 

#target Illustrator


//Script name: Save Document and Extract PDFs
//Author: William Dowling
//Creation Date: 10/15/15
/*
    Saves active document to user's desktop in dated folder with order number as filename.    Saves each artboard as a PDF with artboard name as filename.
*/


function container(){
    var docRef = app.activeDocument;    var layers = docRef.layers;    var aB = docRef.artboards;    var dest = findDest();    var date = getDate();       function findDest(){        var dest = new Folder("~/Desktop" + "/Today's Orders");        return dest.fsName;    }       function getDate(){            var today = new Date();            var dd = today.getDate();            var mm = today.getMonth()+1;            var yyyy = today.getYear();            var yy = yyyy-100;            if(dd<10) {                dd='0'+dd            }            if(mm<10) {                mm='0'+mm            }            return mm+'.'+dd+'.'+yy;        }       dest = "/Volumes/Macintosh HD" + dest + " " + date;    if(!dest.exists){        var newFolder = new Folder(dest);        newFolder.create();    }    if(docRef.name.substring(0,2) == "Un"){        var oN = prompt("Enter Order Number", "1234567");        var fileName = oN;    }    else{        var fileName = docRef.name;    }    var saveFile = new File(dest + "/" + fileName);    if(saveFile.exists){        if(!confirm("This File already exists.. Do you want to overwrite?", false, "Overwrite file?")){            return;        }    }    docRef.saveAs(saveFile);    var pdfdest = dest + "/" + fileName.substring(0,fileName.indexOf(".ai")) + "_PDFs";    var pdfFolder = new Folder(pdfdest);    if(!pdfFolder.exists){        pdfFolder.create();    }    else if(pdfFolder.exists){        if(!confirm("The PDFs folder for this order already exists.. Do you want to overwrite?", false, "Overwrite PDFs Folder?")){            return;        }        else{            //pdfFolder.Delete(); //within this else statement, i'd like to remove the folder or it's contents and start with a fresh folder            pdfFolder = new Folder(pdfdest);            pdfFolder.create();        }    }       //loop artboards to save individual PDFs       var pdfSaveOpts = new PDFSaveOptions();    pdfSaveOpts.preserveEditability = false;    pdfSaveOpts.viewAfterSaving = false;    var seq = 1;    for(var a=0;a<aB.length;a++){        var range = (a+1).toString();        pdfSaveOpts.artboardRange = range;        var pdfFile = new File(pdfdest + "/" + aB[a].name);        var thisPDF = new File(pdfFile + ".pdf");        if(thisPDF.exists){            thisPDF = new File(pdfFile + " " + seq.toString());            docRef.saveAs(thisPDF, pdfSaveOpts);            seq++;        }        else{            docRef.saveAs(pdfFile, pdfSaveOpts);        }    }
}
container();

Adding Artboards ?

$
0
0

How do you add and name an ArtBoard ? I've been putting Artboards.add() in a variable but keep getting an error ?

window panel snippet

$
0
0

Beginning to use ScriptUI and I'm hoping the following snippet of code is correct ?

var ui = new window
ui.type = window;
ui.title = "something";
ui.bounds = Bounds;
ui.propeties = true;

SVG-files into one layered AI-file

$
0
0

Hello good guys!

Although I'm new to scripting Illustrator, I'm looking for a script that can help me – and merge 10 SVG-files into one layered AI-file.

 

I get a lot of projects which contents 10 individual SVG-files that are exported from a GIS program (Map data). Each SVG-file contents specific stuff like water, roads, houses etc., so when 'merging' them together, the result will be one final map. I'll need to copy each SVG-file into a new layer so the end result will be a layered AI-file.

 

I was thinking that the script should do something like this:

 

- Find a folder using a dialog box and open its SVG-files (each project has 10 SVG-files (same size))

- Copy the content from each SVG-file into a new document (same size as the SVG-file) on a separate layer

  (The new document will then have 10 layers)

  (Naming each layer the same as the SVG-file name)

- Close all the SVG-files, leaving the new AI-file on the screen

 

I'll would be very glad if someone could point me in the right direction for this project … Thanks

 

- Kenn

Dealing with Compound Paths made of Groups

$
0
0

I've had some errors reported by my art team recently and i've traced the issue down to compoundPathItems being composed of groupItems instead of pathItems.

 

I'm attempting to verify the fill/stroke color of these items which seems to be impossible if the compoundPathItem is made of groups. It seems the only relevant property of compoundPathItem is pathItems (but the length of this property is zero because it only contains groupItems, which is not available).

 

Does anyone know of a way to access the groupItems nested inside a compoundPathItem???


for loop error

$
0
0

I'm getting a ). error with the following code ?

if (i=0;i<5;i++) {
lyrOne[] = app.activeDocument.layers.add();

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)

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!

Saving single page from multi page PDF to original file

$
0
0

Hi All

 

I'm trying to open a single page from a multi page pdf using illustrator, edit the page and then save it back to the original multi page pdf, however I'm struggling to get the desired behaviour using a script.

 

On opening the pdf manually the page selection dialog states "To save this page back to the original multiple-page pdf, use the "Save" command, and this works when I click it, however when I use a script to save the opened pdf it only saves an ai file and doesn't updates the original pdf.

 

Here's the line in the script I tried to use to get the same behaviour as clicking 'save':

app.activeDocument.save()

 

Can anyone suggest how I might be able to achieve this in a script? I could consider art boards but it seems there should be a simple way to get the same behaviour as clicking save.

 

Thanks for any pointers.

How to divide all textFrames in one-character-per-textFrame?

$
0
0

Hello:

 

How to divide all textFrames in one-character-per-textFrame?

 

Example: the textFrame "Letters" will be divided in 7 textFrames: "L", "e", "t", "t", "e", "r", "s".

 

Help, please.

ScriptUI - bring palette to front on Mac

$
0
0

Howdy yall!  Please consider this:  on my Windows 7 home computer I am able to create UI progress bars and popup messages for my UI window and everything works just fine.  Now, I come to work on the Macintosh and they don't work so well.  In this question, I would like to learn if there is a technique to bring a palette to the front when one is created, such as for this progress bar example, on a Mac.  The palette appears deactivated and in back for me.  It is unseen most of the time because it appears in the center of the screen behind the window by default, and when I move my window we can see the palette but there is no progress bar going on.

 

As you can see in the screenshot, my main window is deactivated because I attempted to get the progress bar active by deactivating the main window, obviously not successful.  I also set the palette to active, which did not work.

 

And, as I have implied, on my home computer on Windows things appear just as expected with the progress bar working and palettes appearing in front and active.  Does anybody know what could be the issue?

 

Thank you!

 

Screen shot 2012-09-15 at 9.36.24 AM.png

Link to a web page from AI javascript?

$
0
0

I've written a script with a ScriptUI interface, which other people will be using. I'd like to include a 'help' button in the interface, which ideally would connect to a web page with more details. (The alternative is to create the 'help' window in javascript, but the web page already exists and it would be a shame not to use it.)

 

From what I've read, other Creative Suite programs may be able to connect to the web with javascript, but apparently not Illustrator. Can anyone please confirm this is so? Or better, point me towards a solution!

 

With thanks.


Object Options

$
0
0

I'm looking for any of the options available from within Illustrators Select > Object in the Reference guide does it exist ?

PageItem.applyEffect(LiveEffectXML)

$
0
0

I am wondering if anyone has been able to figure out what kind of "LiveEffectXML" is a parameter to PageItem.applyEffect()

It's been years since this feature has been out, but no documentation anywhere.

How do I set tabs in textFrames with tabStops?

$
0
0

Could anyone show me the javascript syntax, or point me to a script, that sets tabStops and positions them.

 

I can't get it working.

 

Please ask if any further clarification or explanation would be usefull.

Trim Filename

$
0
0

I have a script that I'm running and it's placing an image in a template... All of the files I will be placing will start with a 6 digit number... I need to be able to grab just those six digits and enter them as text... I currently have it set to provide a dialog... but I want to automate it to grab the first 6 characters automatically...

Any help is greatly appreciated....

 

Here is an excerpt of the script that contains the portion i need to change it currently is removing the extension

 

//Place the PS # on PS Line

var placed_image = (app.activeDocument.placedItems[0].file.name);

var pointTextRef = app.activeDocument.textFrames.add();

var trim = placed_image;

trim = trim.replace(/(.*)\.[^.]+$/, "$1"); // This is the line I need changed to keep only the first 6 characters/digits

pointTextRef.contents = trim;

pointTextRef.textRange.characterAttributes.size = 12;

pointTextRef.top = -661;

pointTextRef.left = 142;

PathPoint on GradientMesh ?

$
0
0

I'm wondering if I need to use PathPoint to verify if a point on a gradientMesh has been selected ?

Viewing all 12845 articles
Browse latest View live


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