Quantcast
Viewing all 12845 articles
Browse latest View live

How to script the 'Export as...' feature?

I want to export artboards as PNG files in a JavaScript. In the past I used the ExportOptionsPNG24, but font comes out fussy in small sizes.

Is there a way to script the export-as-feature in Illustrator? (File > Export as > PNG with artboards and anti-aliasing/Type optimized)

I haven’t found anything in the scripting reference 2017:

http://wwwimages.adobe.com/content/dam/Adobe/en/devnet/illustrator/sdk/CC2017/Illustrator_ JavaScript_Scripting_Reference.pdf (edited)

Any hints welcome. I just want to know, if it's possible. No need for a final script. ;-)

 


OVERLAP OBJECTS

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

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.

Unembed All Images?

Hi everyone,

 

I was just wondering if there could be a "unembed all images" script out there. I have a pdf previously created in Word that I've imported into AI CC 2015 and need to create links out of all the embedded images in the doc.

 

Any help or reply is greatly appreciated,

 

Thanks!

 

 

Andy

Extract text from illustrator for translation then replace with translated text

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 divide all textFrames in one-character-per-textFrame?

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.

How to embed multiple images

Hello!

 

I have been tying to figure out how I could easily embed multiple linked images easily. I have some 1000 .svg  images which have about 1-7 .tif images linked in to them. I now need to get those links embedded and becouse of the amount of images I'm hoping to make an action out of it. I have a script to embed single image in .svg but haven't have luck with multiple embeddings.

 

Any ideas?

fill color using a script.

I'm trying to create a script in CS5 mac os10.6.8 that will change the fill color of selected pathItems. I need a simple script that will change a selected pathItem to cmyk values 2,3,15,0. I will then select this script and implement the action in a batch of 600 files.

 

I wish this process could be recorded as an action but when I record the action "add new swatch" I have to manually input the cmyk values, which will take forever for a batch of over 600 files.


How to user Document.importFile() function?

Hello,

 

I would like to try out the Document.importFile() function introduced in CC2015.

 

Illustrator 2015 changes?

 

CC2015Document.importFile (importFile: File )
Adobe Illustrator 19 Type Library
Import the file into current Ai document.
importFile: Data Type: File

The file to import in the current document.

 

 

But I don't know which arguments to pass to the function.

I tried this code:

 

var doc = app.activeDocument;

var file = File('/Users/outcrash/Desktop/Sketches/CM8319_big.svg');

doc.importFile(file);

 

But I get "Illegal argument - argument 2"

 

I tried several variations for the second argument: 1, true, false, null etc...

 

Looking at the Data Browser in ESTK, the function clearly exists, but there are no arguments shown:

Image may be NSFW.
Clik here to view.
Screen Shot 2017-06-14 at 5.30.35 PM.png

 

When i print out the function like this:

$.writeln(doc.exportSelectionAsAi);

 

I only get this in the console:

 

function importFile() {

    [native code]

}

 

I also tried stepping into the function by setting a breakpoint, but it wouldn't go into the code.

 

Has anybody tried that function already and know which arguments to pass?

Group existing objects using Scripting API ?

Am I missing something, or is there no way to group existing objects using the scripting api ? You can add() to  GroupItems but that doesn't help you with existing objects.

Change file name while saving with actions/macros.

Hey all,

 

I'm setting actions in Illustrator to save multiple file formats of the same file to streamline workflow.
Is there any way to add to a filename using/while using the actions?

 

Ex:

 

Saving business card designs I need to save five PDF files:
Front
Front w/o crop marks

Back

Back w/o crop marks

and Full art.

 

Is there a way to add the description to/modify the file name within actions?

 

So if the original name is:
Client_BC

 

I can run the action and it will auto save
Client_BC_Front.pdf

Client_BC_Front_NoCrop.pdf

Client_BC_Back.pdf

Client_BC_Back_NoCrop.pdf

and
Client_BC.pdf

 

??

 

Does that make sense?

 

Any and all help is very appreciated.

 

Thanks!

progress bar to update as script runs

Hi, I'd like to have a progress bar being displayed as my script runs. I created a simple progress bar as follows:

 

var win = new Window("palette", "SnpCreateProgressBar", [150, 150, 600, 260]); 
win.pnl = win.add("panel", [10, 10, 440, 100], "Script Progress");
win.pnl.progBar = win.pnl.add("progressbar", [20, 35, 410, 60], 0, 100);
win.pnl.progBarLabel = win.pnl.add("statictext", [20, 20, 320, 35], "0%");

win.show();

                    while(win.pnl.progBar.value < win.pnl.progBar.maxvalue)                    {                              // this is what causes the progress bar increase its progress                              win.pnl.progBar.value++;             win.pnl.progBarLabel.text = win.pnl.progBar.value+"%";                              $.sleep(10);                    }    alert('Done!'); 

win.close();

 

Now, if I target the ExtendScript Toolkit, I can see the "animation" of the bar progressing. But If I target illustrator, I only see when it's at 0% and then it jump to 100%. Is there a way to update the information visually as the script progresses?

 

Thanks!

 

I'm running CS6 on mac.

#INCLUDE IN WINDOWS OS

Hi, How do I use #include in a Windows operating system?

 

Could you show me an example?

 

Thanks

How to delete the path between anchors using scripts?

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

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?


Advanced "Save as PDF" script that saves 2 PDF presets with 2 different names.

Hi Everyone,

 

I am looking to improve a save as pdf workflow and was hoping to get some direction. Here is the background...

 

I routinely have to save numerous files as 2 separate PDFs with different settings (a high res printable version and a low res email version). Each file has to be renamed as follows...

 

Original filename = MikesPDF.ai

High Res PDF Filename = MikesPDF_HR.pdf

Low Res PDF Filename = MikesPDF_LR.pdf

 

I was able to alter the default "SaveAsPDF" script to save the files to my desired settings and to add the suffix to the name. So with these scripts here is how the workflow operates...

 

1. Open all files I wish to save as pdfs

2. Select script to save files as high res pdfs

3. Illustrator asks me to choose a destination.

4. Illustrator adds the appropriate suffix and saves each file as a pdf to my desired setting. ("Save As" not "Save a Copy").

5. Now all of the open windows are the new pdfs, not the original ai files.

6. Now I have to close each window. For some reason Illustrator asks me if I want to save each document when I tell it to close window, even though the file was just saved. I tell it to not save and everything seems to be fine.

7. Reopen all the files I just saved as high res pdfs.

8. Repeat the entire process except I run the script specifically designed for the low res pdfs.

 

What I would like to do is to combine these two processes so that there will be one script that saves both pdfs. From what I understand, the script can't support "Save A Copy" so the workflow would go as follows...

 

1. Open all files I wish to save as pdfs

2. Select single script to save files as both high res and low res pdfs

3. Illustrator asks me to choose a destination.

4. Illustrator saves each file as a High Res PDF and adds the the "_HR" suffix.

5. Illustrator then re-saves the open windows as a Low Res PDF and replaces the "_HR" suffix with "_LR".

 

Here is the code for the High Res script, The Low Res script is pretty much the same except for a different preset name and different suffix. Any pointer that anyone could give me would be most appreciated. I am pretty much a noob to this stuff so please keep that in mind.

 

Thanks!

Mike

 

---------------------------CODE----------------------------

 

/** Saves every document open in Illustrator

  as a PDF file in a user specified folder.

*/

 

 

// Main Code [Execution of script begins here]

 

 

try {

  // uncomment to suppress Illustrator warning dialogs

  // app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;

 

 

  if (app.documents.length > 0 ) {

 

 

  // Get the folder to save the files into

  var destFolder = null;

  destFolder = Folder.selectDialog( 'Select folder for PDF files.', '~' );

 

 

  if (destFolder != null) {

  var options, i, sourceDoc, targetFile;

 

  // Get the PDF options to be used

  options = this.getOptions();

  // You can tune these by changing the code in the getOptions() function.

 

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

  sourceDoc = app.documents[i]; // returns the document object

 

  // Get the file to save the document as pdf into

  targetFile = this.getTargetFile(sourceDoc.name, '.pdf', destFolder);

 

  // Save as pdf

  sourceDoc.saveAs( targetFile, options );

  }

  alert( 'Documents saved as PDF' );

  }

  }

  else{

  throw new Error('There are no document open!');

  }

}

catch(e) {

  alert( e.message, "Script Alert", true);

}

 

 

/** Returns the options to be used for the generated files. --------------------CHANGE PDF PRESET BELOW, var NamePreset = ----------------

  @return PDFSaveOptions object

*/

function getOptions()

{var NamePreset = 'Proof High Res PDF';

  // Create the required options object

  var options = new PDFSaveOptions();

     options.pDFPreset="High Res PDF";

  // See PDFSaveOptions in the JavaScript Reference for available options

 

  // Set the options you want below:

 

 

  // For example, uncomment to set the compatibility of the generated pdf to Acrobat 7 (PDF 1.6)

  // options.compatibility = PDFCompatibility.ACROBAT7;

 

  // For example, uncomment to view the pdfs in Acrobat after conversion

  // options.viewAfterSaving = true;

 

  return options;

}

 

 

/** Returns the file to save or export the document into.----------------CHANGE FILE SUFFIX ON LINE BELOW, var newName = ------------------

  @param docName the name of the document

  @param ext the extension the file extension to be applied

  @param destFolder the output folder

  @return File object

*/

function getTargetFile(docName, ext, destFolder) {

  var newName = "_HR";

 

 

  // if name has no dot (and hence no extension),

  // just append the extension

  if (docName.indexOf('.') < 0) {

  newName = docName + ext;

  } else {

  var dot = docName.lastIndexOf('.');

  newName = docName.substring(0, dot)+newName;

  newName += ext;

  }

 

  // Create the file object to save to

  var myFile = new File( destFolder + '/' + newName );

 

  // Preflight access rights

  if (myFile.open("w")) {

  myFile.close();

  }

  else {

  throw new Error('Access is denied');

  }

  return myFile;

}

Anti-aliasing Type Optimized/Art Optimized on PNG export

Hello there,

 

I'm modifying a javascript that makes an export of each layer contained in an Illustrator document and I want to specify the method used for anti-aliasing (either Type Optimized or Art Optimized). Similarly to the option under the "Image size" tab in the "Save for the Web" panel.

 

I didn't find any antiAliasingMethod property in the ExportOptionsPNG24 properties (only an antiAliasing property that accepts boolean). So I wonder if it is actually possible to do it through scripting?

 

Many thanks,

D

Export multiple PDF Presets in Illustrator

When exporting projects, we use a number of PDF (and image) presets to create print ready files, proofs, and web files. The Export for Screens feature will not allow us to export multiple PDF Presets (i.e. export print ready PDFsat the same time as smallest file size PDFs). Is there a script I can use to get this much needed feature?

 

Much obliged,

Aadam

Splitting the array into pairs.

Hi,

I have array with numbers and i want to create pairs from this table, like this:

 

var doc = app.activeDocument;

 

var table = ["1", "2", "3", "4", "5", "6", "7", "8", "9","10"]; // the table will be variable so the number of pairs will be variable too there can be 2-4 numbers and  it can be 30.

 

 

//some magic function or loop

var pairs = {

           1. pair = ["1", "2"]

           2. pair = ["2", "3"]

           3. pair = ["3", "4"]

           4. pair = ["4", "5"] etc.

} ;

Illustrator CC Book Color vs Spot Color PANTONE+

Hi! Here's a question about a little detail regarding PANTONE+ spot colors.
I've got a script that makes PANTONE+ colors inside a document using the available scripting methods, which produce a spot color with the desired Lab color values, but when double-clicking and bringing up the swatch dialog it does not default to the grayed-out "Book Color" option in the Color Mode dropdown.

However, it does have the Book Color option in that dropdown and if it's selected and applied, the next time this swatch is double-clicked and dialog appears, the proper Book Color mode is selected and appropriate fields are grayed out.

 

My question is: considering the functions of spot colors in Illustrator, ink plating and appearance and anything else, does my script-made swatch bear any effect on the document that would make it in any way different than a regular document where the Book Color is shown as default in the swatch options dialog?

 

In Mordy Golding's explanation of Book Color mode for Pre-CS6 versions, he states that Book Colors came with hidden information which displays PANTONE-listed Lab values which relate to the Pre-CS6 CMYK-based PANTONE swatches. Now that we have PANTONE+, and Lab is the default base for the book swatches, I wonder if there is any other property that may not be considered by some function of the application if the swatch has the correct name and Lab values while not having the Book Color mode explicitly selected.

Also, if there's an undocumented property for setting the other Color Modes which can appear in this dropdown, that would also be useful information. Our current available options for SpotColorKind are just SPOTCMYK, SPOTLAB and SPOTRGB
Image may be NSFW.
Clik here to view.
Screen Shot 2015-10-04 at 6.57.46 PM.png

Image may be NSFW.
Clik here to view.
Lab-VS-Book.png

Viewing all 12845 articles
Browse latest View live


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