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

how do i place a textframe central to the artboard

$
0
0

This is my very first attempt at a script:

all tips are greatfully recieved

 

 

 

 

* this script will prompt  the user for a file name and location and then

    save the current file as a .pdf with secure save options*/

var curDoc = app.activeDocument;

var destName = prompt ("Enter a Filename Daniel", "", "Save With  Security");

var destFolder = Folder.selectDialog('Select which folder to save to :');

saveFileToPDF(destFolder+ '/' + destName); // not sure if i need this here ?

 

 

 

 

/* this will annotate the document with a breadcrumb trail

    then resave the file with the same security settings*/

 

 

 

 

                                        // i need to find a method of placing this central to the artboard, but as the text has random dimensions its proving difficult also there are multiple artboards

var pointTextRef = curDoc.textFrames.add();

pointTextRef.contents = curDoc.name + '  ' + curDoc.fullName;

pointTextRef.top = 735;

pointTextRef.left = 20;

saveFileToPDF(destFolder+ '/' + destName); // i need this here

 

 

//

 

function saveFileToPDF (dest) {

var doc = app.activeDocument;

if ( app.documents.length > 0 ) {

var saveName = new File ( dest );

saveOpts = new PDFSaveOptions();

saveOpts.requirePermissionPassword = true;

saveOpts.permissionPassword = "test";

doc.saveAs( saveName, saveOpts );

 

 

}

}

 

i can do the math of (artboard width)-(text width) / 2 is start point of text but how do i find out the text width and the artboard width?

 

Message was edited by: tonyxamax


Is it possible to create droplet?

$
0
0
Is it possible to create a droplet in "illustrator cs"?

Looking for "Replace with Symbol" script

$
0
0

So I am trying to replace gps points with a symbol I have created. I have found blogs referencing a script that can replace selected items with symbols saved in the symbols panel, but I can't seem to find the actual script! If anyone knows where I can find JET_ReplaceWithSymbol.jsx or any other script that can do the same function, it would be greatly appreciated!

Script Panel - Work in progress

$
0
0

Hi All,

Working on a Script Panel to make scripts simpler to run in illustrator.

This is a work in progress...

Untitled-3-01.jpg

 

Looking for some people to help test and make suggestions.

 

at the moment this is a Windows only program... Sorry Mac users

and right now it is still an AHK file.

 

so I'm looking for people who already use AHK (AutoHotKey)

 

both files need to be saved in the same directory. would be best if they had their own folder.

Settings file needs to be manually updated at this point and will need the path to your desired script folder and the path to your illustrator updated for it to work.


once AHK file is running it will scan the script folder for scripts.

will also scan sub folders but only 1 deep, this way groups of scripts can be organized.

Window will appear center screen, just drag the panel to where you want it.

so far you can mouse click any script to run it.

it is also tied to the "Tilde" or "Back Tick" / "~" or "`" no shift needed.

This will make the window active and allow you keyboard access to the scripts. ie. "Tilde 24 Enter" will run script 24


I have plans for settings window so any variable such as paths, font etc. can be set from the program.

And also will make the sub folders collapsible for simpler viewing.


Can't wait for thoughts and suggestions.


http://qwertyfly.com/files/Script%20Menu/





Selecting objects by colour and moving to another layer

$
0
0

Hi there,

 

I've managed to google together a script based off others that work in illustrator CS 5.5 but not in the latest version?

Objectives of this script

Step 1: Add Layer and call it "Register"

Step 2: Select all objects based on colour called "Register" and move to layer called "Register"

Step 3: Rename "Layer 1" to "Thru-cut"

Step 4: Save and then close document.

 

Could someone here have a look at the below script and let me know where its gone wrong? Below is also a screenshot of the script error in the latest version of illustrator.

 

Thank you.

 

Error.jpg

 

var myDoc = app.activeDocument;

var myLayer = myDoc.layers.add();

myLayer.name = "Register";

 

 

function getObjectsByColor ( colorName )

{

var doc, items, i = 0, n = 0, item, color, selectionArray = [];

 

 

if ( app.documents.length == 0 ){

    alert("No documents open");

    return;

}

 

 

doc = app.activeDocument;

try

{

    color = doc.swatches.getByName ( colorName );

}

catch(e)

{

    alert( "No such color !");

    return;

}

 

 

color = color.color ;

 

 

items = doc.pageItems;

n = items.length;

if ( items.length == 0 )

{

    alert( "No items found");

    return;

}

 

 

for ( i = 0; i < n ; i++ )

{

    item = items[i];

    if ( item.fillColor.typename == color.typename

    && item.fillColor.cyan == color.cyan

    && item.fillColor.magenta == color.magenta

    && item.fillColor.yellow == color.yellow

    && item.fillColor.black == color.black )

    {

        selectionArray [ selectionArray.length ] = item;

    }

}

 

 

for ( i = 0; i < n ; i++ )

{

        item = items[i];

    if ( item.fillColor.typename == color.typename

    && item.fillColor.cyan == color.cyan

    && item.fillColor.magenta == color.magenta

    && item.fillColor.yellow == color.yellow

    && item.fillColor.black == color.black )

    {

item.move( myLayer, ElementPlacement.PLACEATBEGINNING );

}

}

 

 

if ( selectionArray.length == 0 )

{

    alert( "Nothing found" );

    return;

}

app.selection = selectionArray;

}

 

 

getObjectsByColor ("Register");

 

 

function renameText() {

    if (app.documents.length == 0) return;

    var docRef = app.activeDocument;

    recurseLayers(docRef.layers);

    }

     

    renameText();

   

function recurseLayers(objArray) {

    for (var i = 0; i < objArray.length; i++) {        

    objArray[i].name = objArray[i].name.replace(/\s*Layer 1\s*\d*/, 'Thru-cut');        

    if (objArray[i].layers.length > 0) recurseLayers(objArray[i].layers);

    }

}

 

 

// save as

 

 

var originalInteractionLevel = userInteractionLevel;

userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;

 

 

saveFileToPDF ();

 

 

function saveFileToPDF () {

    var doc = app.activeDocument;

    if ( app.documents.length > 0 ) {

        saveOpts = new PDFSaveOptions();

        saveOpts.compatibility = PDFCompatibility.ACROBAT5;

        saveOpts.generateThumbnails = true;

        saveOpts.preserveEditability = true;

        doc.save(saveOpts );

    }

}

 

 

userInteractionLevel = originalInteractionLevel;

 

 

myDoc.close();

Place PDF Pages in Illustrator

$
0
0

Carlos, you created a script i believe called AI_openMultiPagePDF.

 

And that is awesome, However i was wondering if you could change it just a bit and instead of opening the files, could you use the PLACE command instead?

 

The problem i have had is that some PDF's have embedde fonts that i dont have but if i place it, then flatten transparency>Convert Outlines i can use the PDF excatly as it was and not have it convert the fonts.

 

Is that an easy script change?

 

Here is your script

 

 

#target illustrator

#targetengine session

 

 

// script.name = AI_openMultiPagePDF_CS4_CS5_v1.02.jsx;

// script.description = opens a multipage PDF;

// script.required = requires CS4 or later

// script.parent = CarlosCanto // 01/07/12;  v1.2-01/15/12

// script.elegant = false;

 

 

// Notes: I didn't try opening a ridiculous amount of pages, I "only" open 35 pages....in about a minute and a half.

//                     Use with caution, save everything before running, script is memory intensive...

 

 

// Lion fix by John Hawkinson 01/15/12

 

 

//----------------------- START UI CODE, create user interface

var win = new Window ("dialog", "MTools - Open Multipage PDF");

 

 

var fileGroup = win.add("group"); // this is the group on the left, it holds the File button and the Font label note

 

 

var btnFile = fileGroup.add("button", undefined, "File..."); // button to select the PDF to open

var lblFonts = fileGroup.add("statictext",undefined,"Unavailable\nFonts\nwill be\nsubstituted.", {multiline:true}); //

 

 

var grpRight = win.add("group"); // group on the right, to hold everything else

var txtFile = grpRight.add("edittext",undefined); // to hold selected PDF file path

 

 

var grpPanel = grpRight.add("group");

var pagesPanel = grpPanel.add("panel", undefined, "Page Range");

var lblFrom = pagesPanel.add("statictext",undefined,"From:");

var txtFrom = pagesPanel.add("edittext",undefined, 1);

var lblTo = pagesPanel.add("statictext",undefined,"To:");

var txtTo = pagesPanel.add("edittext",undefined, 1);

 

 

var btnGroup = grpPanel.add("group");

var btnOk = btnGroup.add("button", undefined, "Open");

var btnCancel = btnGroup.add("button", undefined, "Cancel");

 

 

var lblStatus = grpRight.add("statictext",undefined,"Open Multipage PDF requires CS4 or later...");

 

 

win.orientation = pagesPanel.orientation = "row"; // two items fileGroup and grpRight

win.alignChildren = "right";

fileGroup.orientation = "column";

fileGroup.alignment = "top";

txtFile.alignment = ["fill","top"];

lblStatus.alignment = "left";

 

 

grpRight.orientation = "column";

btnGroup.orientation = "column";

btnOk.enabled = false; // disable this button until a valid file is supplied

 

 

txtFrom.characters = txtTo.characters = 3;

btnFile.active = true; // receive the first "Enter"

 

 

win.helpTip = "\u00A9 2012 Carlos Canto";

grpRight.helpTip = "Not tested with a ridiculous amount of pages";

 

 

 

 

//------------------------ get the PDF file

btnFile.onClick = function(){

          txtFile.text = ""; // clear previous File path if any

          btnOk.enabled = false; // disable the Ok button

          var fileRef = File.openDialog ("Select PDF...", "*.pdf"); // get the file

          fileRef = new File(fileRef.fsName.replace("file://","")); // Lion fix by John Hawkinson

          if(fileRef!= null && fileRef.exists) // check if it is valid file, it should be, unless after clicking a file, the name gets edited

                    {

                              txtFile.text = fileRef.fsName; // show the file Path here

                              btnOk.enabled = true; // enable the Ok button

                              txtTo.active = true; // move focus to change the last page to open

                    }

}

 

 

//------------------------

btnOk.onClick = function(){

          doSomething(); // call main function.

          win.close(); // close when done

}

 

 

//------------------------ on leaving this text, check again if file exist, in case file path is typed instead of clicking the File...button

txtFile.onDeactivate = function(){

          //alert("on deactivate")

          var file = File(txtFile.text); // create a file based on the text edit control

          if (file.exists){ // and chekc for existance, if it does

                    btnOk.enabled = true; // enable the Ok button

          }

          else { // if it does not exist

                    btnOk.enabled = false; // disable the Ok button

          }

}

 

 

//------------------------

 

 

win.center ();

win.show();

//-------------------------END UI CODE

 

 

function doSomething() // Open each page in the range, group all art, move to a new document, then

          {                                                                      // with all pages on top of each other, create artboards and move each page

                                                                                          // to its final own layer, own artboard.

// get first page and last page to open

$.hiresTimer; // start timer

                    var from = txtFrom.text;

                    var to = txtTo.text;

 

 

// create destination document, pdf open options, etc

                    app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;

                    var fileRef = File(txtFile.text); // get file from text edit

                    //alert(fileRef.name)

 

 

                    var idoc = app.documents.add(); // add a document;

                    var pdfOptions = app.preferences.PDFFileOptions;

                    pdfOptions.pDFCropToBox = PDFBoxType.PDFBOUNDINGBOX;

 

 

                    var spacing = 10; // space between artboards

                    var arrPagesInfo = []; // to hold each PDF page name, doc size and art position

 

                    for (j=from; j<=to; j++) // open all pages in range, group art, and move the dest document

                              {

                                        pdfOptions.pageToOpen = j;

// Open a file using these preferences

 

 

                                        var pdfDoc = open(fileRef, DocumentColorSpace.RGB);

                                        lblStatus.text = "\u00A9 2012 Carlos Canto - Opening page " + j;

                                        win.update();

                                        var pdfLayer = pdfDoc.activeLayer;

 

 

// add a group and group all items

                                        var items = pdfLayer.pageItems; // get all items in layer, there's only one layer, right?

                                        var tempGrp = pdfDoc.groupItems.add(); // to group everything in page

                                        tempGrp.name = "Page " + j; // name the group, "Page 1", "Page 2", etc

 

                                        for (i=items.length-1; i>0; i--) // group all items

                                                  {

                                                            items[i].move(tempGrp,ElementPlacement.PLACEATBEGINNING);

                                                  }

 

// get document bounds

 

                                        var pdfw = pdfDoc.width;

                                        var pdfh = pdfDoc.height;

                                        var activeAB = pdfDoc.artboards[0];

 

 

                                        pdfLeft = activeAB.artboardRect[0];

                                        pdfTop = activeAB.artboardRect[1];

 

 

                                        if (j==from)

                                                  {

                                                            firstabRect = activeAB.artboardRect;

                                                            abRect = firstabRect;

                                                            //$.writeln(abRect);

                                                  }

                                        else

                                                  {

// TODO                              // x = 8498 seems to be the canvas max X position, check and make another row if a page gets to here

                                                            if ((abRect[2]+spacing+pdfw)>=8494) // if rightmost artboard position surpases the canvas size,

                                                                      {

                                                                                var ableft = firstabRect[0]; // position next artboard below the first one

                                                                                var abtop = firstabRect[3]-spacing;

                                                                                var abright = ableft + pdfw;

                                                                                var abbottom = abtop - pdfh;

                                                                                firstabRect = [ableft, abtop, abright, abbottom];

                                                                      }

                                                            else // if we don't get to the canvas edge, position next artboard, to the right of the last one

                                                                      {

                                                                                var ableft = pageSpecs[3][2]+spacing; // pageSpecs[3] = abRect // abRect[2] = right position

                                                                                var abtop = pageSpecs[3][1]; // abRect[1] = top position

                                                                                var abright = ableft + pdfw;

                                                                                var abbottom = abtop - pdfh;

                                                                      }

                                                            abRect = [ableft, abtop, abright, abbottom];

                                                  }

 

 

// get this group position relative to top/left

                                        var deltaX = tempGrp.left-pdfLeft;

                                        var deltaY = pdfTop-tempGrp.top;

 

 

// make an array to hold each page Name, width, height, deltaX, deltaY

                                        pageSpecs = [tempGrp.name, deltaX, deltaY,abRect]; // pageSpecs holds last page info, it gets overwritten as we add pages

                                        arrPagesInfo.unshift(pageSpecs); // unshift to make first page, the last in the array

 

 

// duplicate grouped page 1 onto dest document

                                        newItem = tempGrp.duplicate( idoc,ElementPlacement.PLACEATBEGINNING);

 

 

// close current PDF page

                                        pdfDoc.close (SaveOptions.DONOTSAVECHANGES);

 

 

                              } // end for all pages to open

 

 

// Stage 2, create layers and artboards for each PDF page (group) and reposition

// loop thru the groups, add artboards for each and reposition

                              var ilayer = idoc.layers[idoc.layers.length-1]; // the one layer so far

                              for(k=arrPagesInfo.length-1; k>=0; k--) // last item in the array holds the first PDF page info

                                        {

// add new layer and new AB

                                                  var newAB = idoc.artboards.add(arrPagesInfo[k][3]);

                                                  var newLayer = idoc.layers.add();

                                                  newLayer.name = arrPagesInfo[k][0]

 

// reposition group relative to top/left

                                                  var igroup = ilayer.groupItems[k];

 

 

                                                  igroup.left = newAB.artboardRect[0]+arrPagesInfo[k][1];

                                                  igroup.top = newAB.artboardRect[1]-arrPagesInfo[k][2];

                                                  igroup.move(newLayer,ElementPlacement.PLACEATEND);

// add new artboard to the left of existing one

                                                  lblStatus.text = "Repositioning page " + k;

                                                  win.update();

                                        }

                              idoc.artboards[0].remove();

                              ilayer.remove();

 

                    app.userInteractionLevel = UserInteractionLevel.DISPLAYALERTS;

                    var time = $.hiresTimer/1000000; // end timer

                    lblStatus.text = "Copyright 2012 \u00A9 Carlos Canto";

                    alert(arrPagesInfo.length +" pages opened in " + time.toFixed(2) + " seconds" ); // 35 pages opened in 98-99 seconds

                    //$.writeln(time);

          }// end doSomething Function

updating scripts to CC from CS6

$
0
0

Hello World!

 

I've got a lot of scripts that I've been updating but for some reason my ETSK isn't wanting to run them in CC, only CS6.  I make sure the target is set to "Adobe Illustrator CC 2015 (19.064) but when I hit run it changes to CS6.  Below is a snippet from the first part of my code, not sure what I'm missing.  I did a search for converting scripts from CS6 to CC and mainly came up with Photoshop stuff.  If you could kindly point me to some reference guides it would be most helpful in my endeavors.

 

I'm not sure what all scripting functions have changed / removed / added with the change from CS6 so this is a challenge that I look forward to.

 

Many thanks!

 

#target illustrator;
//#targetengine "session";

app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;

///// BUILDING THE PALETTE WINDOW
/////  First line also shows the palette version
var w = new Window("palette","Script Menu V2.0",undefined,{closeButton:true});
//w.graphics.backgroundColor = w.graphics.newBrush (w.graphics.BrushType.SOLID_COLOR, [.75, .75, .75]);
w.orientation = "row";
w.alignment = "left";
w.margins = 1;
w.spacing = 0;

 

 

If you need me to past my entire code I will, it is currently at 758 lines and this includes any notes.

improve or simplify this batch script

$
0
0

sorry my bad english

Hello, I've combined some scripts in this forum, to make an image processor as Photoshop, I wonder if this script is right or if you can simplify more

 

This script convert AI to PSD, Pdf, Png, Jpg, AI v3 - cc2015, select resolution and included to subfolders (optional)

 

Español

 

hola, he combinado algunos scripts en este foro, para crear algo similar al procesador de photoshop, me gustaría saber si este script se puede mejorar o simplificar para que procese más rápido.

 

este script procesa un Ai a Psd, Pdf, Png, Jpg y Ai v3 hasta la CC2015, además puede escoger la resolución de la exportación para PSD,PNG y JPG, también uno puede elegir que busque en subcarpetas

 

 

 

var format = prompt('Choose a File Type Extension  :\nai, psd, pdf, jpg, png', "png", 'Batch');
if (format == "ai" || format == "psd" || format == "pdf" || format == "jpg" || format == "png") {  if (format == "jpg" || format == "png" || format == "psd") {  var res = prompt('DPI resolution ', 300, 'Batch');  }  if (format == "ai") {  alert("Adobe Ai versions :\n\nAdobe 3.0 = 3\n\nAdobe 8.0 = 8\n\nAdobe 9.0 = 9\n\nAdobe 10 = 10\n\nAdobe CS1 = 11\n\nAdobe CS2 = 12\n\nAdobe CS3 = 13\n\nAdobe CS4 = 14\n\nAdobe CS5 = 15\n\nAdobe CS6 = 16\n\nAdobe CC 2013,2014,2015 = 17")  var cs = prompt('Type Ai version ', 17, 'Batch');  }  var folder = Folder.selectDialog("Select Source Folder...");  var files;  var resolution = res;  var ver = cs;  //exporting  //var lFolder = new Folder(folder + "/" + format);  //lFolder.create();  if (folder != null) {  var subcarpets = prompt('Include subfolders when searching? yes o no?', "no", 'Batch');  if (subcarpets == "no" || subcarpets == "yes") {  if (subcarpets == "no") {  files = folder.getFiles("*.ai");  }  if (subcarpets == "yes") {  files = find_files(folder, ['.ai']);  }  var fileCount = files.length; // count them  var log = fileCount + ' Files Processed  to ' + format + '\n';  if (fileCount > 0) {  for (i = 0; i < fileCount; i++) {  var idoc = app.open(files[i]);  var tipe = files[i].name.substr(0, files[i].name.lastIndexOf('.')) || files[i].name;  if (format == "ai") {  exportAI();  }  if (format == "psd") {  exportPSD();  }  if (format == "pdf") {  exportPDF();  }  if (format == "jpg") {  exportJPG();  }  if (format == "png") {  exportPNG();  }  log += files[i] + " to " + tipe + "." + format + '\n';  }  alert(fileCount + ' file(s) processed to ' + format);  txtlog = new File(folder + '/textlog.txt');  var isopen = txtlog.open("w"); //open file for editing  if (isopen) //test file is open  {  txtlog.seek(0, 0);  txtlog.write(log);  txtlog.close();  }  } else {  alert("There are no Illustrator files in this folder.");  }  } else {  alert("sorry, the option \"" + subcarpets + "\" no exist.");  }  }
}


/////////////////////////////////////subfolders - Peter Kharel/////////////////////////////////////////////////////////////////
// recurse subfolders - Peter Kharel
function find_files(dir, mask_array) {
  var arr = [];  for (var i = 0; i < mask_array.length; i++) {  arr = arr.concat(find_files_sub(dir, [], mask_array[i].toUpperCase()));  }  return arr;
}


function find_files_sub(dir, array, mask) {
  var f = Folder(dir).getFiles('*.*');  for (var i = 0; i < f.length; i++) {  if (f[i]instanceof Folder) {  find_files_sub(f[i], array, mask);  } else if (f[i].name.substr(-mask.length).toUpperCase() == mask) {  array.push(f[i]);  }  }  return array;
}
//////////////////////////////////////TIPOS DE ARCHIVOS/////////////////////////////////////////////////////////////////


function exportPNG() {


  var pngExportOpts = new ExportOptionsPNG24();  pngExportOpts.antiAliasing = true;  pngExportOpts.artBoardClipping = true;  pngExportOpts.horizontalScale = (resolution / 72) * 100;  //pngExportOpts.matte = true;  //pngExportOpts.matteColor = 0, 0, 0;  pngExportOpts.saveAsHTML = false;  pngExportOpts.transparency = true;  pngExportOpts.verticalScale = (resolution / 72) * 100;  idoc.exportFile(files[i], ExportType.PNG24, pngExportOpts);  idoc.close(SaveOptions.DONOTSAVECHANGES);  return pngExportOpts;
}


function exportJPG() {


  var jpgExportOpts = new ExportOptionsJPEG();  jpgExportOpts.antiAliasing = true;  jpgExportOpts.qualitySetting = 100;  jpgExportOpts.horizontalScale = (resolution / 72) * 100;  jpgExportOpts.verticalScale = (resolution / 72) * 100;  jpgExportOpts.optimization = true;  jpgExportOpts.artBoardClipping = true;  idoc.exportFile(files[i], ExportType.JPEG, jpgExportOpts);  idoc.close(SaveOptions.DONOTSAVECHANGES);  return jpgExportOpts;
}


function exportAI() {


  var dest = new File(files[i] + "_v"+ver+".ai");  var illustratorSaveOpts = new IllustratorSaveOptions();  if (ver == 17) {  illustratorSaveOpts.compatibility = Compatibility.ILLUSTRATOR17;  }  if (ver == 16) {  illustratorSaveOpts.compatibility = Compatibility.ILLUSTRATOR16;  }  if (ver == 15) {  illustratorSaveOpts.compatibility = Compatibility.ILLUSTRATOR15;  }  if (ver == 14) {  illustratorSaveOpts.compatibility = Compatibility.ILLUSTRATOR14;  }  if (ver == 13) {  illustratorSaveOpts.compatibility = Compatibility.ILLUSTRATOR13;  }  if (ver == 12) {  illustratorSaveOpts.compatibility = Compatibility.ILLUSTRATOR12;  }  if (ver == 11) {  illustratorSaveOpts.compatibility = Compatibility.ILLUSTRATOR11;  }  if (ver == 10) {  illustratorSaveOpts.compatibility = Compatibility.ILLUSTRATOR10;  }  if (ver == 9) {  illustratorSaveOpts.compatibility = Compatibility.ILLUSTRATOR9;  }  if (ver == 8) {  illustratorSaveOpts.compatibility = Compatibility.ILLUSTRATOR8;  }  if (ver == 3) {  illustratorSaveOpts.compatibility = Compatibility.ILLUSTRATOR3;  }  illustratorSaveOpts.embedLinkedFiles = true;  illustratorSaveOpts.fontSubsetThreshold = 0.0  illustratorSaveOpts.pdfCompatible = true  illustratorSaveOpts.embedICCProfile = false  idoc.saveAs(dest, illustratorSaveOpts);  idoc.close(SaveOptions.DONOTSAVECHANGES);  return illustratorSaveOpts;


}


function exportPDF() {


  var pdfSaveOpts = new PDFSaveOptions();  pdfSaveOpts.acrobatLayers = false;  pdfSaveOpts.colorBars = false;  pdfSaveOpts.colorCompression = CompressionQuality.AUTOMATICJPEGHIGH;  pdfSaveOpts.compressArt = true; //default  pdfSaveOpts.embedICCProfile = true;  pdfSaveOpts.enablePlainText = true;  pdfSaveOpts.generateThumbnails = true; // default  pdfSaveOpts.optimization = true;  pdfSaveOpts.pageInformation = false;  pdfSaveOpts.preserveEditability = false;  idoc.saveAs(files[i], pdfSaveOpts);  idoc.close(SaveOptions.DONOTSAVECHANGES);  return pdfSaveOpts;


}


function exportPSD() {


  var psdExportOpts = new ExportOptionsPhotoshop();  idoc.documentColorSpace == DocumentColorSpace.CMYK ? psdExportOpts.imageColorSpace = ImageColorSpace.CMYK : psdExportOpts.imageColorSpace = ImageColorSpace.RGB;  psdExportOpts.antiAliasing = true;  psdExportOpts.embedICCProfile = true;  psdExportOpts.writeLayers = true;  psdExportOpts.resolution = resolution;  psdExportOpts.maximumEditability = true;  idoc.exportFile(files[i], ExportType.PHOTOSHOP, psdExportOpts);  idoc.close(SaveOptions.DONOTSAVECHANGES);  return psdExportOpts


}





Issue opening jpg in Photoshop from Illustrator script

$
0
0

Hi all!

 

I have a javascript file that I use in Illustrator to export a collection of jpegs, and then open those images in Photoshop to be resized. This all worked great in CS5, but when we swapped over to CS6 the images no longer open up in Photoshop. We are using Photoshop 64-bit and Illustrator 64-bit on a Windows 7 system.

 

Here is the code that worked in CS5:

//gets the name of the jpg to open
openFile = new File(this.base_path +"/"+ this.prefix + connector + ex +fileType)
photoshop.open(File(openFile));

 

Seems like it should be pretty straightforward, not sure what could be causing the issue. I put alerts on either side of the line, and photoshop.open is the line that breaks it. I have tested it with a if (openFile.exists) condition to make sure the file path was correct, and it would throw an alert confirming it existed, but anything after that was cut out. Did the syntax for opening a file in Photoshop change from CS5 to CS6? Any help is appreciated!

Is there another directory to install scripts in Illustrator?

$
0
0

Recently, I wrote a VBScript that can save whatever work is done in Illustrator as an SVG file and then open it up using another program. My script works perfectly well but that's not why I'm here.

 

I would like the other program that opens up the SVG to be able to install the script from within. That means, this other program should have a button where you just click 'install Illustrator extension' and then it copies over the VBScript to the /Program Files/Adobe/Adobe Illustrator CC 2015/Presets/Scripts folder. Right now, the program is a java executable and in theory it should work. The problem is that I get access denied every time I try to install the script. If I run the program as an administrator it all works fine though, but I would like my users to not have to run the program as administrator.

 

My question is if there is a way that I can install a script for Illustrator on a path that is not through /Program Files/ since this requires special permissions? Is there another directory on the user's home that Illustrator could check for loading onto the scripts menu? Shouldn't there be, like if different users on the same computer want to have different extensions what do they do?

How to import symbols from a symbol library?

$
0
0

I need to import symbols from an Ai file to other documents by script, then place them by replacing objects.

I have no problem with the replacement of a symbol when it's part of the symbols of the document.

What I fail to do, it's the importation of a symbol collection from an Ai file to the current document.

 

I load the symbol document as a symbol library, in this way:

 

var openOptions = new OpenOptions();
openOptions.openAs = LibraryType.SYMBOLS;
var symbolDocument = app.open(File('/d/test/symbol_collection.ai'), null, openOptions);

 

It works well as it opens a symbol collection window in Illustrator.

But I don't know how to get these symbols to copy them into the current document.

When I invoke symbolDocument.symbols, I get a 'The document is no longer open' error.

 

So, how to copy symbols? How to access this symbol collection loaded in Illustrator other than using the symbolDocument?

Thanks a lot.

Convert EPS to PDF with Artboard Resize

$
0
0

Hi,

I needed a script for a batch conversion from EPS to PDF files. In addition, the output PDF had to fit into A4/Letter size documentation page.

I've created one and now as I've tested it and it won't make any harm to your machine, I am sharing the script on Github.

Feel free to use it and modify it.

Script UI, images + radio buttons

$
0
0

I am making a script to speed up proofing. I have a large portion of the work done but I've gotten a request to add an option to have more than one product per proof. I figure adding options for 2, 3, or 4 products per proof should cover most instances. The issue I'm having is with the UI. I have already been to ScriptUI for dummies | Peter Kahrel and it has been incredibly helpful. That is where I got the info for embedding the images. I don't know if what I want to do is possible. I would like my dialog to look like this:

CCproofMultiDialog_wish.png

Which I slapped together in photoshop. The closest I've gotten is this:

Screen shot 2015-06-25 at 7.56.35 AM.png

And it's not just that it's ugly, I can deal with ugly if it's functional, but as you can see you can select more than one radio button at the same time. I tried to play with replacing the "undefined" with [left, top, width, height] on each of my objects but then my dialog was entirely blank. Here is the code that makes the current UI:

#target Illustrator


if ( app.documents.length != 0 ){
  myDlg = new Window('dialog', 'Proof Multi Up');  myDlg.orientation = 'column';  myDlg.alignment = 'left';  var twoUpX = "\u0089PNG\r\n\x1A\n\x00\x00\x00\rIHDR\x00\x00\x00\x15\x00\x00\x00\x15\b\x02\x00\x00\x00&u2\u00C1\x00\x00\x01\x1BiTXtXML:com.adobe.xmp\x00\x00\x00\x00\x00<?xpacket begin=\"\u00EF\u00BB\u00BF\" id=\"W5M0MpCehiHzreSzNTczkc9d\"?>\n<x:xmpmeta xmlns:x=\"adobe:ns:meta/\" x:xmptk=\"XMP Core 5.1.2\">\n <rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n  <rdf:Description rdf:about=\"\"/>\n </rdf:RDF>\n</x:xmpmeta>\n<?xpacket end=\"r\"?>1\u00A8qi\x00\x00\x00\tpHYs\x00\x00\x0B\x13\x00\x00\x0B\x13\x01\x00\u009A\u009C\x18\x00\x00\x019iCCPPhotoshop ICC profile\x00\x00x\u00DA\u00AD\u0091\u00B1J\u00C3P\x14\u0086\u00BF\x1BE\u00C5\u00A1V\b\u00E2\u00E0p'QPl\u00D5\u00C1\u008CI[\u008A X\u00ABC\u0092\u00ADIC\u0095\u00D2$\u00DC\u00DC\u00AA}\bG\u00B7\x0E.\u00EE>\u0081\u0093\u00A3\u00E0\u00A0\u00F8\x04\u00BE\u0081\u00E2\u00D4\u00C1!Hp\x12\u00C1o\u00FA\u00CE\u00CF\u00E1p\u00E0\x07\u00A3b\u00D7\u009D\u0086Q\u0086A\u00ACU\u00BB\u00E9H\u00D7\u00F3\u00E5\u00EC\x133L\x01@'\u00CCR\u00BB\u00D5:\x00\u0088\u00938\u00E2'\x02>_\x11\x00\u00CF\u009Bv\u00DDi\u00F07\u00E6\u00C3Ti`\x02lw\u00A3,\x04Q\x01\u00FA\x17:\u00D5 \u00C6\u0080\x19\u00F4S\r\u00E2\x0E0\u00D5I\u00BB\x06\u00E2\x01(\u00F5r\x7F\x01JA\u00EEo@I\u00B9\u009E\x0F\u00E2\x030{\u00AE\u00E7\u00831\x07\u0098A\u00EE+\u0080\u00A9\u00A3K\rPK\u00D2\u0091:\u00EB\u009DjY\u00B5,K\u00DA\u00DD$\u0088\u00E4\u00F1(\u00D3\u00D1 \u0093\u00FBq\u0098\u00A84Q\x1D\x1Du\u0081\u00FC?\x00\x16\u00F3\u00C5v\u00D3\u0091kU\u00CB\u00DA[\u00E7\u009Fq=_\u00E6\u00F6~\u0084\x00\u00C4\u00D2c\u0091\x15\u0084Cu\u00FE\u00DD\u0085\u00B1\u00F3\u00FB\\\u00DC\x18/\u00C3\u00E1-LO\u008Al\u00F7\nn6`\u00E1\u00BA\u00C8V\u00ABP\u00DE\u0082\u00FB\u00F1\x17\u00C2\u00B3O\u00FE\x1C\t\u00B3'\x00\x00\x00 cHRM\x00\x00z%\x00\x00\u0080\u0083\x00\x00\u00F9\u00FF\x00\x00\u0080\u00E8\x00\x00R\b\x00\x01\x15X\x00\x00:\u0097\x00\x00\x17o\u00D7Z\x1F\u0090\x00\x00\x00HIDATx\u00DAb\u00FC\u00FF\u00FF?\x03\x05\u0080\u0085\u0081\u0081AII\u0091<\u00CD\u00F7\u00EE\u00DDg\u00F8\u00FF\u00FF\u00BF\u00A2\u00A2\u00C2\x7F\x1C\u0080\u00A0\x14\x13\x03e`T\u00FF\u00A8\u00FEQ\u00FDCW?\x0B\u0084\u00C2S\x04\u00E1/\u009D\x18),\u00FF\x00\x00\x00\x00\u00FF\u00FF\x03\x00\u00AF\u008A@\u00DFM8\u0092\u0083\x00\x00\x00\x00IEND\u00AEB`\u0082";  var twoUpY = "\u0089PNG\r\n\x1A\n\x00\x00\x00\rIHDR\x00\x00\x00\x15\x00\x00\x00\x15\b\x02\x00\x00\x00&u2\u00C1\x00\x00\x01\x1BiTXtXML:com.adobe.xmp\x00\x00\x00\x00\x00<?xpacket begin=\"\u00EF\u00BB\u00BF\" id=\"W5M0MpCehiHzreSzNTczkc9d\"?>\n<x:xmpmeta xmlns:x=\"adobe:ns:meta/\" x:xmptk=\"XMP Core 5.1.2\">\n <rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n  <rdf:Description rdf:about=\"\"/>\n </rdf:RDF>\n</x:xmpmeta>\n<?xpacket end=\"r\"?>1\u00A8qi\x00\x00\x00\tpHYs\x00\x00\x0B\x13\x00\x00\x0B\x13\x01\x00\u009A\u009C\x18\x00\x00\x019iCCPPhotoshop ICC profile\x00\x00x\u00DA\u00AD\u0091\u00B1J\u00C3P\x14\u0086\u00BF\x1BE\u00C5\u00A1V\b\u00E2\u00E0p'QPl\u00D5\u00C1\u008CI[\u008A X\u00ABC\u0092\u00ADIC\u0095\u00D2$\u00DC\u00DC\u00AA}\bG\u00B7\x0E.\u00EE>\u0081\u0093\u00A3\u00E0\u00A0\u00F8\x04\u00BE\u0081\u00E2\u00D4\u00C1!Hp\x12\u00C1o\u00FA\u00CE\u00CF\u00E1p\u00E0\x07\u00A3b\u00D7\u009D\u0086Q\u0086A\u00ACU\u00BB\u00E9H\u00D7\u00F3\u00E5\u00EC\x133L\x01@'\u00CCR\u00BB\u00D5:\x00\u0088\u00938\u00E2'\x02>_\x11\x00\u00CF\u009Bv\u00DDi\u00F07\u00E6\u00C3Ti`\x02lw\u00A3,\x04Q\x01\u00FA\x17:\u00D5 \u00C6\u0080\x19\u00F4S\r\u00E2\x0E0\u00D5I\u00BB\x06\u00E2\x01(\u00F5r\x7F\x01JA\u00EEo@I\u00B9\u009E\x0F\u00E2\x030{\u00AE\u00E7\u00831\x07\u0098A\u00EE+\u0080\u00A9\u00A3K\rPK\u00D2\u0091:\u00EB\u009DjY\u00B5,K\u00DA\u00DD$\u0088\u00E4\u00F1(\u00D3\u00D1 \u0093\u00FBq\u0098\u00A84Q\x1D\x1Du\u0081\u00FC?\x00\x16\u00F3\u00C5v\u00D3\u0091kU\u00CB\u00DA[\u00E7\u009Fq=_\u00E6\u00F6~\u0084\x00\u00C4\u00D2c\u0091\x15\u0084Cu\u00FE\u00DD\u0085\u00B1\u00F3\u00FB\\\u00DC\x18/\u00C3\u00E1-LO\u008Al\u00F7\nn6`\u00E1\u00BA\u00C8V\u00ABP\u00DE\u0082\u00FB\u00F1\x17\u00C2\u00B3O\u00FE\x1C\t\u00B3'\x00\x00\x00 cHRM\x00\x00z%\x00\x00\u0080\u0083\x00\x00\u00F9\u00FF\x00\x00\u0080\u00E8\x00\x00R\b\x00\x01\x15X\x00\x00:\u0097\x00\x00\x17o\u00D7Z\x1F\u0090\x00\x00\x00CIDATx\u00DAb\u00FC\u00FF\u00FF?\x03\x05\u0080\u0085\u0081\u0081AII\u0091<\u00CD\u00F7\u00EE\u00DDg\u0081\u00B3H\u00D5\f\u00B1\u0095\u0089\u008120\u00AA\x7F`\u00F5\u00B3 G&\u00F9\u00***\u00D3\u00CFh\u00FA!\x0B0RX\u00FE\x01\x00\x00\x00\u00FF\u00FF\x03\x00\u00FF\x18\x0F\u00F7\u00E2\u00A5\x1E\x0F\x00\x00\x00\x00IEND\u00AEB`\u0082";  var threeUpX = "\u0089PNG\r\n\x1A\n\x00\x00\x00\rIHDR\x00\x00\x00\x15\x00\x00\x00\x15\b\x02\x00\x00\x00&u2\u00C1\x00\x00\x01\x1BiTXtXML:com.adobe.xmp\x00\x00\x00\x00\x00<?xpacket begin=\"\u00EF\u00BB\u00BF\" id=\"W5M0MpCehiHzreSzNTczkc9d\"?>\n<x:xmpmeta xmlns:x=\"adobe:ns:meta/\" x:xmptk=\"XMP Core 5.1.2\">\n <rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n  <rdf:Description rdf:about=\"\"/>\n </rdf:RDF>\n</x:xmpmeta>\n<?xpacket end=\"r\"?>1\u00A8qi\x00\x00\x00\tpHYs\x00\x00\x0B\x13\x00\x00\x0B\x13\x01\x00\u009A\u009C\x18\x00\x00\x019iCCPPhotoshop ICC profile\x00\x00x\u00DA\u00AD\u0091\u00B1J\u00C3P\x14\u0086\u00BF\x1BE\u00C5\u00A1V\b\u00E2\u00E0p'QPl\u00D5\u00C1\u008CI[\u008A X\u00ABC\u0092\u00ADIC\u0095\u00D2$\u00DC\u00DC\u00AA}\bG\u00B7\x0E.\u00EE>\u0081\u0093\u00A3\u00E0\u00A0\u00F8\x04\u00BE\u0081\u00E2\u00D4\u00C1!Hp\x12\u00C1o\u00FA\u00CE\u00CF\u00E1p\u00E0\x07\u00A3b\u00D7\u009D\u0086Q\u0086A\u00ACU\u00BB\u00E9H\u00D7\u00F3\u00E5\u00EC\x133L\x01@'\u00CCR\u00BB\u00D5:\x00\u0088\u00938\u00E2'\x02>_\x11\x00\u00CF\u009Bv\u00DDi\u00F07\u00E6\u00C3Ti`\x02lw\u00A3,\x04Q\x01\u00FA\x17:\u00D5 \u00C6\u0080\x19\u00F4S\r\u00E2\x0E0\u00D5I\u00BB\x06\u00E2\x01(\u00F5r\x7F\x01JA\u00EEo@I\u00B9\u009E\x0F\u00E2\x030{\u00AE\u00E7\u00831\x07\u0098A\u00EE+\u0080\u00A9\u00A3K\rPK\u00D2\u0091:\u00EB\u009DjY\u00B5,K\u00DA\u00DD$\u0088\u00E4\u00F1(\u00D3\u00D1 \u0093\u00FBq\u0098\u00A84Q\x1D\x1Du\u0081\u00FC?\x00\x16\u00F3\u00C5v\u00D3\u0091kU\u00CB\u00DA[\u00E7\u009Fq=_\u00E6\u00F6~\u0084\x00\u00C4\u00D2c\u0091\x15\u0084Cu\u00FE\u00DD\u0085\u00B1\u00F3\u00FB\\\u00DC\x18/\u00C3\u00E1-LO\u008Al\u00F7\nn6`\u00E1\u00BA\u00C8V\u00ABP\u00DE\u0082\u00FB\u00F1\x17\u00C2\u00B3O\u00FE\x1C\t\u00B3'\x00\x00\x00 cHRM\x00\x00z%\x00\x00\u0080\u0083\x00\x00\u00F9\u00FF\x00\x00\u0080\u00E8\x00\x00R\b\x00\x01\x15X\x00\x00:\u0097\x00\x00\x17o\u00D7Z\x1F\u0090\x00\x00\x00EIDATx\u00DA\u00EC\u00D4\u00B1\r\x00 \f\x03A\x071\b\u00C9\u00FE3\u00C1(OM\u0087H\u0085\u0094/-]k\x03\u0094\u00A8K\u008A\u00F07<\u00E7\x12\u00E0>8\u00BB_\u009Ar\u0095/_\u00FE_o@\u00E6\x7F,\u00F9\x7F\x1B\x00\x00\u00FF\u00FF\x03\x00\u00A1\u008DCt\u00DD\u0091{\x0F\x00\x00\x00\x00IEND\u00AEB`\u0082";  var threeUpY = "\u0089PNG\r\n\x1A\n\x00\x00\x00\rIHDR\x00\x00\x00\x15\x00\x00\x00\x15\b\x02\x00\x00\x00&u2\u00C1\x00\x00\x01\x1BiTXtXML:com.adobe.xmp\x00\x00\x00\x00\x00<?xpacket begin=\"\u00EF\u00BB\u00BF\" id=\"W5M0MpCehiHzreSzNTczkc9d\"?>\n<x:xmpmeta xmlns:x=\"adobe:ns:meta/\" x:xmptk=\"XMP Core 5.1.2\">\n <rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n  <rdf:Description rdf:about=\"\"/>\n </rdf:RDF>\n</x:xmpmeta>\n<?xpacket end=\"r\"?>1\u00A8qi\x00\x00\x00\tpHYs\x00\x00\x0B\x13\x00\x00\x0B\x13\x01\x00\u009A\u009C\x18\x00\x00\x019iCCPPhotoshop ICC profile\x00\x00x\u00DA\u00AD\u0091\u00B1J\u00C3P\x14\u0086\u00BF\x1BE\u00C5\u00A1V\b\u00E2\u00E0p'QPl\u00D5\u00C1\u008CI[\u008A X\u00ABC\u0092\u00ADIC\u0095\u00D2$\u00DC\u00DC\u00AA}\bG\u00B7\x0E.\u00EE>\u0081\u0093\u00A3\u00E0\u00A0\u00F8\x04\u00BE\u0081\u00E2\u00D4\u00C1!Hp\x12\u00C1o\u00FA\u00CE\u00CF\u00E1p\u00E0\x07\u00A3b\u00D7\u009D\u0086Q\u0086A\u00ACU\u00BB\u00E9H\u00D7\u00F3\u00E5\u00EC\x133L\x01@'\u00CCR\u00BB\u00D5:\x00\u0088\u00938\u00E2'\x02>_\x11\x00\u00CF\u009Bv\u00DDi\u00F07\u00E6\u00C3Ti`\x02lw\u00A3,\x04Q\x01\u00FA\x17:\u00D5 \u00C6\u0080\x19\u00F4S\r\u00E2\x0E0\u00D5I\u00BB\x06\u00E2\x01(\u00F5r\x7F\x01JA\u00EEo@I\u00B9\u009E\x0F\u00E2\x030{\u00AE\u00E7\u00831\x07\u0098A\u00EE+\u0080\u00A9\u00A3K\rPK\u00D2\u0091:\u00EB\u009DjY\u00B5,K\u00DA\u00DD$\u0088\u00E4\u00F1(\u00D3\u00D1 \u0093\u00FBq\u0098\u00A84Q\x1D\x1Du\u0081\u00FC?\x00\x16\u00F3\u00C5v\u00D3\u0091kU\u00CB\u00DA[\u00E7\u009Fq=_\u00E6\u00F6~\u0084\x00\u00C4\u00D2c\u0091\x15\u0084Cu\u00FE\u00DD\u0085\u00B1\u00F3\u00FB\\\u00DC\x18/\u00C3\u00E1-LO\u008Al\u00F7\nn6`\u00E1\u00BA\u00C8V\u00ABP\u00DE\u0082\u00FB\u00F1\x17\u00C2\u00B3O\u00FE\x1C\t\u00B3'\x00\x00\x00 cHRM\x00\x00z%\x00\x00\u0080\u0083\x00\x00\u00F9\u00FF\x00\x00\u0080\u00E8\x00\x00R\b\x00\x01\x15X\x00\x00:\u0097\x00\x00\x17o\u00D7Z\x1F\u0090\x00\x00\x00BIDATx\u00DAb\u00FC\u00FF\u00FF?\x03\x05\u0080\u0085\u0081\u0081AII\u0091<\u00CD\u00F7\u00EE\u00DDg\u0081\u00B3H\u00D5\f\u00B1\u0095\u0089\u008120\u00D4\u00F5\u00B3 \x07\x06\u00F9\u00***\u00C3\x7F4\u00FCGd\u00F83RX\u00FE\x01\x00\x00\x00\u00FF\u00FF\x03\x00p\u0099\x13`\u0095\u00B6Q\u00E8\x00\x00\x00\x00IEND\u00AEB`\u0082";  var fourUp = "\u0089PNG\r\n\x1A\n\x00\x00\x00\rIHDR\x00\x00\x00\x15\x00\x00\x00\x15\b\x02\x00\x00\x00&u2\u00C1\x00\x00\x00\tpHYs\x00\x00\x0B\x13\x00\x00\x0B\x13\x01\x00\u009A\u009C\x18\x00\x00\x019iCCPPhotoshop ICC profile\x00\x00x\u00DA\u00AD\u0091\u00B1J\u00C3P\x14\u0086\u00BF\x1BE\u00C5\u00A1V\b\u00E2\u00E0p'QPl\u00D5\u00C1\u008CI[\u008A X\u00ABC\u0092\u00ADIC\u0095\u00D2$\u00DC\u00DC\u00AA}\bG\u00B7\x0E.\u00EE>\u0081\u0093\u00A3\u00E0\u00A0\u00F8\x04\u00BE\u0081\u00E2\u00D4\u00C1!Hp\x12\u00C1o\u00FA\u00CE\u00CF\u00E1p\u00E0\x07\u00A3b\u00D7\u009D\u0086Q\u0086A\u00ACU\u00BB\u00E9H\u00D7\u00F3\u00E5\u00EC\x133L\x01@'\u00CCR\u00BB\u00D5:\x00\u0088\u00938\u00E2'\x02>_\x11\x00\u00CF\u009Bv\u00DDi\u00F07\u00E6\u00C3Ti`\x02lw\u00A3,\x04Q\x01\u00FA\x17:\u00D5 \u00C6\u0080\x19\u00F4S\r\u00E2\x0E0\u00D5I\u00BB\x06\u00E2\x01(\u00F5r\x7F\x01JA\u00EEo@I\u00B9\u009E\x0F\u00E2\x030{\u00AE\u00E7\u00831\x07\u0098A\u00EE+\u0080\u00A9\u00A3K\rPK\u00D2\u0091:\u00EB\u009DjY\u00B5,K\u00DA\u00DD$\u0088\u00E4\u00F1(\u00D3\u00D1 \u0093\u00FBq\u0098\u00A84Q\x1D\x1Du\u0081\u00FC?\x00\x16\u00F3\u00C5v\u00D3\u0091kU\u00CB\u00DA[\u00E7\u009Fq=_\u00E6\u00F6~\u0084\x00\u00C4\u00D2c\u0091\x15\u0084Cu\u00FE\u00DD\u0085\u00B1\u00F3\u00FB\\\u00DC\x18/\u00C3\u00E1-LO\u008Al\u00F7\nn6`\u00E1\u00BA\u00C8V\u00ABP\u00DE\u0082\u00FB\u00F1\x17\u00C2\u00B3O\u00FE\x1C\t\u00B3'\x00\x00\x00 cHRM\x00\x00z%\x00\x00\u0080\u0083\x00\x00\u00F9\u00FF\x00\x00\u0080\u00E8\x00\x00R\b\x00\x01\x15X\x00\x00:\u0097\x00\x00\x17o\u00D7Z\x1F\u0090\x00\x00\x00KIDATx\u00DAb\u00FC\u00FF\u00FF?\x03\x05\u0080\u0085\u0081\u0081AII\u0091<\u00CD\u00F7\u00EE\u00DDg\u00F8\u00FF\u00FF\u00BF\u00A2\u00A2\u00C2\x7F\x1C\u0080\u00A0\x14\x13\x03e`T\u00FF\u00C0\u00EAg\u0081Px\u0092\x10\u0081\u00D45\u009A~F\u00D3\x0F\x05\u00E9\u0087\u0091\u00C2\u00F2\x0F\x00\x00\x00\u00FF\u00FF\x03\x00Lcx\u0099H\u00AC\u00D4\u00B5\x00\x00\x00\x00IEND\u00AEB`\u0082";  with(myDlg.add('group'))  {  orientation = 'row';  with(myDlg.add('group'))  {  // left, top, width, and height  orientation = 'column';  alignment = 'left';  add("Image", undefined, twoUpX);  twoUpXbutton = add('RadioButton', undefined, "Two items per proof arranged horizontally.");  twoUpXbutton.alignment = 'left';  add('statictext', undefined, "");  add("Image", undefined, twoUpY);  twoUpYbutton = add('RadioButton', undefined, "Two items per proof arranged vertically.");  twoUpYbutton.alignment = 'left';  add('statictext', undefined, "");  add("Image", undefined, threeUpX);  threeUpXbutton = add('RadioButton', undefined, "Three items per proof arranged horizontally.");  threeUpXbutton.alignment = 'left';  add('statictext', undefined, "");  add("Image", undefined, threeUpY);  threeUpYbutton = add('RadioButton', undefined, "Three items per proof arranged vertically.");  threeUpYbutton.alignment = 'left';  add('statictext', undefined, "");  add("Image", undefined, fourUp);  fourUpbutton = add('RadioButton', undefined, "Four items per proof.");  fourUpbutton.alignment = 'left';  }  }  with(myDlg.add('group'))  {  orientation = 'row';  alignment = 'left';  btnOk = add('button', undefined, "OK",{name: 'ok'});  add('button', undefined, "Cancel",{name: 'cancel'});  }  btnOk.onClick = function(){  alert("result" + "\n" + "Two up X value " + twoUpXbutton.value + "\n" + "Two up Y value " + twoUpYbutton.value + "\n" + "Three up X value " + threeUpXbutton.value + "\n" + "Three up Y value " + threeUpYbutton.value + "\n" + "Four up value " + fourUpbutton.value);  myDlg.close();  }  myDlg.show();
} else {  alert ( "A document must be open." );
}

Any advice would be appreciated.

 

P.S. I've got a superfluous group in there from some sloppy editing, whoops!

looping through collection of symbols and populating a drop down on a form EXTENDSCRIPT

$
0
0

Hello everyone-

 

I got a question.  Would it be possible to run a script that would loop through a collection of symbols in a defined library and populate a drop down with the available symbols. My goal is to be able to open Illustrator, and when I run the script the dropdown is populated with all available symbols(text is fine) in a defined library that I can then select and place on the artboard. Any help would be appreciated.

 

thanks in advance!

Resolution check in illustrator

$
0
0

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


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!

Script Consulting Effort?

$
0
0

I don't know anything about Illustrator scripts, but want to do some automation. I am willing to pay for some consulting effort. I don't think it is too difficult, but hard to say since I don't know the capabilities. Here are a few things I would like to do:

 

- Select the contents on a specific layer (with a known name - "Layer1") and change the stroke thickness. Also, with this layer, change the "cap" and "corner" settings.

- Goto another layer (again with a known name - "Layer2") and perform similar operations.

- Various other things, but those are the big ones.

 

It would need to be done in either JS or VBS (though VBS may be preferred since I am sort of familiar with that). Also, it is my understanding that WSF (windows scripting file) can support running this as well, so it would be nice to embed that in a WSF so it could be run via double click (on the current doc) instead of having to do use dropdown picks to execute the script. I also have a basic WSF file that does some SendKey commands so it would nice to mix the JS or VBS in.

 

Alternatively, maybe someone has some basic code to do this? Or it would be good to know this is simply not possible. Thanks

Export Layers as Individual Files, Delete Other Layers

$
0
0

I currently use the script below to export Ai files with 100+ layers to individual Ai files. The script exports every layer in each file named after the target layer name. The problem with this is all additional layers are exported but set to non visible. Thus if the base file is 80mb every additional file is 80mb. As you can imagine this creates unnecessary file size issues.

 

I ask your help to amend the script so that it only exports each layer and removes the additional hidden and unnecessary layers or doesn't include the unwanted layers.

 

Thank you

 

 

//////////////Start

 

var doc = app.activeDocument;
    
if (documents.length > 0){
        
    // Create the illusrtratorSaveOptions object to set the AI options
    var saveOpts = new IllustratorSaveOptions();
    
    // Setting IllustratorSaveOptions properties. 
    saveOpts.embedLinkedFiles = true;
    saveOpts.fontSubsetThreshold = 0.0
    saveOpts.pdfCompatible = true

 

        
        if (doc.saved==false) doc.save();
        
        for (i=0; i<doc.layers.length; i++)
            if (doc.layers[i].locked == false) doc.layers[i].visible = false;
        fullDocName = doc.fullName;
        var param = doc.name.split('.');
        realDocName = param[0];
        for (i=0; i<doc.layers.length; i++){
            if (i-1<0) doc.layers[i].visible = true;
            else {
                doc.layers[i-1].visible = false;
                doc.layers[i].visible = true;
            }
            if (doc.layers[i].locked == false) {    
                docName = doc.layers[i].name+".ai";    
                var saveName = new File ( doc.path + "/" + docName );
                doc.saveAs( saveName, saveOpts );
            }
        }
        doc.close(SaveOptions.DONOTSAVECHANGES);
        doc = null;
        app.open (fullDocName);
    }

 

/////////End

Calling functions from UI palette

$
0
0

Hello,

From what I understand, you can't call complex functions from a scripted UI palette, only from "dialog" windows (which are usless in my case) because I need the persistance of a palette.

 

I have a series of scripts in use now that are  accessed from the usual "file-scripts folder" within Illustrator itself (about 27 of them).  I want to script a palette window so users can acces them without the usual mouse clicks down the menu system.

 

I'm able to call a simple "Hello World" type function using the "onClick()" method from a button of a scripted palette window, but I cannot use my regular working scripts inside a function that's called from the button.  In X-Code, I was able to write my scripts individually, then just add them to a main floating window via a separate function when they were completed.  But, I'm finding Javascript a little more tricky.

 

If I copy my other's script code into the function in the palette window script, it runs, but it runs before I click the button! --  After in runs, then the palette window is displayed(?).  If I try to use the execute() method with "onClick", the script just opens in the SDK, it will not and does run in Illustrator.

 

I take both of these as clear indications that I have no clue what I'm doing (or that I'm trying to do the impossible).

 

I did find someone with a similar problem, but they were scripting After Effects and were offered this solution:

 

system.callSystem ('afterfx -r "/C/Program Files/Adobe/Adobe After Effects CS3/Support Files/Scripts/GlobalVars.jsx"');

 

 

Is there anything I can do in Illustrator that will allow me to call (or execute) my other scripts/functions and have them execute within Illustrator?

 

Thanks for any and all help!

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

Viewing all 12845 articles
Browse latest View live


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