Quantcast
Channel: Adobe Community : Discussion List - Illustrator Scripting
Viewing all 3671 articles
Browse latest View live

Edit IPTC metada in illustrator extendscript

$
0
0

Hi guys,

 

I'm batch editing all jpeg files metadata. I achieve to edit XMP title,description, keyword of jpeg files. But I want to edit IPTC data of these jpeg files too. Because shutterstock reads metadata from IPTC. So is it possible to edit IPTC description, keyword with extendscript in Illustrator ? if possible how ?

I attached sample jpeg IPTC below. Just I want to copy XMP metadata to suitable IPTC metada.

Any help appreciated ! Thanks !

Screen Shot 2018-02-03 at 9.05.22 PM.png


Using Interop.Illustrator with VS2017 aand C# PlaceItem.File property throwing exception

$
0
0

C# code as example of problem:

        private void Run_OnCLick(object sender, RoutedEventArgs e)

        {

            Document doc = null;

            Illustrator.Application app = null;

            try

            {

                // open AI, init

                app = new Illustrator.Application();

           

                // open doc

                doc = app.Open("D:\\Test\\Vintage\\Package_Test.ait", Illustrator.AiDocumentColorSpace.aiDocumentRGBColor, null);

 

 

                // insert image

                PlacedItem img = doc.PlacedItems.Add();

                int cnt = doc.PlacedItems.Count;

                String file = "D:\\Dev\\Vinatage\\00_Coaster.png";

                img.File = file; //throw exception

                img.Top = 0;

                img.Left = 0;

                img.Height = 5.4;

                img.Width = 5.4;

            }

            catch (COMException ce)

            {

                string msg = ce.StackTrace;

                string errorCode = String.Format("0x{0:X}", ce.HResult);

                MessageBoxResult result = MessageBox.Show(msg, ce.Source, MessageBoxButton.OK, MessageBoxImage.Error);

            }

            finally

            {

                doc.Close(AiSaveOptions.aiDoNotSaveChanges);

                app.Quit();

            }

        }

 

msg =

 

   at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)

   at Illustrator.PlacedItem.set_File(String )

   at WpfApplication1.MainWindow.Run_OnCLick(Object sender, RoutedEventArgs e) in D:\projects\WpfApplication1\WpfApplication1\MainWindow.xaml.cs:line 46

 

I am hoping someone has an idea what is causing this.

 

If I use the AI menu File->Place it works fine ...

Current AI file saved as Package, low-res PDF, and text-outlined AI

$
0
0

Hi,

I have been looking at various scripts made in this forum that have been close to what I am looking for but not quite so I wonder if there would be a kind soul out there who could help out a bit... Here's the process I would need to be done to only the active AI file already open (this original AI file should remain unchanged of course):

 

-Package the current active AI (same as File - Package with all options ticked ON) into a subfolder in the original AI folder; subfolder format "<original AI filename>_Package"

Into this same newly created subfolder also:

-Save a low-res PDF using a PDF preset "MySmallest", add "_low" to the end of filename (i.e. <original AI filename>_low.PDF)

-Save the original AI as AI with all texts converted to outline, add "_outline" to the end of filename (i.e. <original AI filename>_outline.AI)

 

Thanks a million in advance if anyone could help.

-Pete

Duplicate/Move Layer, Outline Text, then Remove Strokes & Change Fill to Black

$
0
0

The ultimate goal of this script is to create a sort of plain black text version of a copy layer (with text that sometimes has various effects/appearances applied).

 

I've got a multi-part script I'm trying to write that will do a few things in order. I've got a few bits cobbled together from other scripts, but it's not entirely working and there's some bits of functionality I don't know how to fit in there. It's actually a bit of a mess and I'm sure there must be a more efficient way to go about it. Could anybody take a look and either point me in the right direction or (if someone had the time) create a more efficient version of this.

 

What I need the script to do:

1. Lock all Layers

2. Duplicate Layer "SOURCE"

3. Rename duped layer to "SOURCE APPROVAL" & hide all other layers

4. Move "SOURCE APPROVAL" layer to below "SOURCE" layer in layers palette

5. Outline all text on "SOURCE APPROVAL" layer

6. Select everything, remove all strokes, and change the Fill color of all objects (whether regular items or compound paths or grouped) to black (only on "SOURCE APPROVAL" layer)

 

 

What I've got so far is a giant mess that does some things, but not others. I haven't been able to get the layers to move to a specific point in the layers palette and I can't seem to affect compound paths to change their color or remove their strokes.

 

var docRef = app.activeDocument; 
var myLayers = docRef.layers;

var layer = app.activeDocument.activeLayer;
var flatBlack= new CMYKColor()
flatBlack.black=100;


for (a=0; a<myLayers.length; a++){     myLayer = myLayers[a];     myLayer.locked = true;
}


#target illustrator 
var ln = 'SOURCE'; 
var ol = docRef.layers.getByName(ln); 
var nl = docRef.layers.add(); 
nl.name = ln+' APPROVAL';          for (var a = ol.pageItems.length-1; a >= 0; a--) {              ol.pageItems[a].duplicate(nl, ElementPlacement.PLACEATBEGINNING);              }       
app.executeMenuCommand("selectall");
app.executeMenuCommand("ungroup");
app.executeMenuCommand("outline");   

 // Iterate through all path items
    for (var i = 0; i < nl.pathItems.length; i++) {      with (nl.pathItems[i]) {        if (filled == true) {          // If black exceeds maxBlack clip it to flat black (100%K)          fillColor = flatBlack;        }        if (stroked == true) {          stroked = false;        }      }    }

Javascript for Illustrator svg

$
0
0

Hello,

I want to create an interactive svg map for a website with hyperlinks on different areas. I can do that, but I would also like the colour/fill of each area to change on mouseover. I believe that needs some javascript adding but that's where my skills end. Can anyone tell me what javascript I need to use to create that colour change effect?

Thanks

How to get the Selected Items X, Y position with MM value

$
0
0

Hi All,

 

In Illustrator CS5 version how to get the X, Y position in Millimeter.

 

In InDesign I can easily get the X,Y position also I can change the ruler origin easily. Illustrator I tried but I failed. Could you please any one guide me.

 

X-Y_Poition.png

 

thx,
csm_phil

Need script to batch convert vector .eps to .svg images script

$
0
0

Hi,

 

I'm looking for a script/program that if you run it, all the .eps files in a folder will batch convert to a .svg.

 

I have already found a script to convert .eps to .png-24, but don't know how to edit it to export to .svg.

 

Pascal

 

.eps to .png-24 script

/********************************************************** ADOBE SYSTEMS INCORPORATED  Copyright 2005 Adobe Systems Incorporated  All Rights Reserved  NOTICE:  Adobe permits you to use, modify, and  distribute this file in accordance with the terms of the Adobe license agreement accompanying it.   If you have received this file from a source  other than Adobe, then your use, modification, or distribution of it requires the prior  written permission of Adobe.  *********************************************************/    /********************************************************** Save as PDFs.js DESCRIPTION This sample gets files specified by the user from the  selected folder and batch processes them and saves them  as PDFs in the user desired destination with the same  file name. **********************************************************/    // Main Code [Execution of script begins here]    // uncomment to suppress Illustrator warning dialogs  // app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;    var destFolder, sourceFolder, files, fileType, sourceDoc, targetFile, pngExportOpts;    // Select the source folder.  sourceFolder = Folder.selectDialog( 'Select the folder with Illustrator files you want to convert to PNG', '~' );    // If a valid folder is selected  if ( sourceFolder != null )  {      files = new Array();      fileType = prompt( 'Select type of Illustrator files to you want to process. Eg: *.ai', ' ' );            // Get all files matching the pattern      files = sourceFolder.getFiles( fileType );            if ( files.length > 0 )      {          // Get the destination to save the files          destFolder = Folder.selectDialog( 'Select the folder where you want to save the converted PNG files.', '~' );          for ( i = 0; i < files.length; i++ )          {              sourceDoc = app.open(files[i]); // returns the document object                                                    // Call function getNewName to get the name and file to save the pdf              targetFile = getNewName();                            // Call function getPNGOptions get the PNGExportOptions for the files              pngExportOpts = getPNGOptions();                            // Export as PNG              sourceDoc.exportFile( targetFile, ExportType.PNG24, pngExportOpts );                            sourceDoc.close(SaveOptions.DONOTSAVECHANGES);          }          alert( 'Files are saved as PNG in ' + destFolder );      }      else      {          alert( 'No matching files found' );      }  }          /********************************************************* getNewName: Function to get the new file name. The primary name is the same as the source file. **********************************************************/    function getNewName()  {      var ext, docName, newName, saveInFile, docName;      docName = sourceDoc.name;      ext = '.png'; // new extension for png file      newName = "";                for ( var i = 0 ; docName[i] != "." ; i++ )      {          newName += docName[i];      }      newName += ext; // full png name of the file            // Create a file object to save the png      saveInFile = new File( destFolder + '/' + newName );              return saveInFile;  }          /********************************************************* getPNGOptions: Function to set the PNG saving options of the  files using the PDFSaveOptions object. **********************************************************/    function getPNGOptions()  {            // Create the PDFSaveOptions object to set the PDF options      var pngExportOpts = new ExportOptionsPNG24();                        // Setting PNGExportOptions properties. Please see the JavaScript Reference      // for a description of these properties.      // Add more properties here if you like      pngExportOpts.antiAliasing = true;      pngExportOpts.artBoardClipping = true;      pngExportOpts.horizontalScale = 100.0;      //pngExportOpts.matte = true;      //pngExportOpts.matteColor = 0, 0, 0;      pngExportOpts.saveAsHTML = false;      pngExportOpts.transparency = true;      pngExportOpts.verticalScale = 100.0;        return pngExportOpts;  } 

Map, Reduce and functional scripting

$
0
0

Hi all,

 

I've been writing scripts and was refactoring some code to utilize functional methods like (map, reduce, filter).

 

It appears that these are completely unsupported. Is this true? I couldn't find any confirmation either way, only that they appear not to work. I can't imagine why this would be the case.

 

Here is a trivial example of a script that fails to run:

 

var x = [4,9,16];
var y = x.map(Math.sqrt);
alert(y);

 

I get the following error: "x.map is not a function".

 

Best wishes,

Jake


Illustrator CC 2017

$
0
0

Is there any way in scripting to copy the file name of the image placed and automatically create it as a type text.
Because I'm working in Yearbook and there's a bunch of Student names needs to input/type.
Please help me on this. !

How to change Area Type Inset Spacing (CC2018 / JS)

$
0
0

I have a script that creates a set of closed paths which it then uses to create area text TextFrameItems.

 

How can I change the insert spacing of these area type text frames within the JS script?

Via the menu it would be Type > Area Type Options > Offset, then change Inset Spacing value to 2.5.

 

I know it could work via a recorded action called from JS, but then the JS script would be less applicable/portable.

Unable to export last asset as PNG out of a selection!

$
0
0

Hi

 

I had wrote a script to export my selection as PNG through asset export. But the last selection is not exporting as PNG throwing an error. When it comes to SVG in the same script its working fine. Ill paste the sample script here, please correct me if I had committed some mistake.

 

I reiterate SVG export working fine in below script its only problem with PNG.

 

 

var doc = app.activeDocument;

var selectedObjects = doc.selection;

 

 

//remove all assets

if (doc.assets.length>0){

doc.assets.removeAll();

}

 

//Adding selection to assets panel

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

     var currentObject = selectedObjects[i];

     doc.selection = currentObject;

     var currentAsset = doc.assets.addFromSelection ();

     currentAsset.assetName = currentObject.name;

}

 

//Collecting new assets

var assets = doc.assets;

 

//Query Asset ID's

var assetArray = [];

for (var z=0; z<assets.length; z++){

    assetArray[z]=assets[z].assetID;

    }

 

//Creation of destination folder

var destFolder = Folder("C:/Users/Xxxxx/Desktop/script/export/Icon_01");

if(!destFolder.exists) destFolder.create();

 

//Defining assets to export

var whatToExport = new ExportForScreensItemToExport();

whatToExport.assets = assetArray;

whatToExport.artboards ="";

 

//As SVG

var svgParams = new ExportForScreensOptionsWebOptimizedSVG();

doc.exportForScreens(destFolder, ExportForScreensType.SE_SVG, svgParams, whatToExport);

 

//As PNG

var pngParams = new ExportForScreensOptionsPNG24();

doc.exportForScreens(destFolder, ExportForScreensType.SE_PNG24, pngParams, whatToExport);

 

alert('done');

Creating a dynamic action to use with app.doScript() method.

$
0
0

Since building dynamic actions is a topic unto itself, we often search for a reference thread to show somebody how to do this - and we often do so while trying to discuss work which is already involved and has nothing to do with actions or loading and playing them. Therefore I'm creating this thread to show an example and I'll paste the url to it when such questions arise.

 

Sometimes in Illustrator scripting we need to accomplish tasks which (sometimes counterintuitively) do not have scripting access via the DOM.

Fortunately since Illustrator CS6, they gave us the ability to play an action from a script with the app.doScript() command - which is not at all the same as Indesign's function of the same name. This one lets you play an action that exists inside the Actions panel. Immediately this may seem disappointing as users cannot be counted on to have specific actions at any given time.

However, they also gave the ability to load and remove actions from .aia action files. Your .aia file just needs to be somewhere and app.loadAction() can read it right into the Actions panel. Same with app.unloadAction(setName, actionName) - where (thanks to qwertyfly) using (setName, "") an empty string argument for the action name will remove the entire set. And when you try to remove an action that does not exist, well, it throws an error - which is how you can check for making absolutely sure that an action set is completely removed.

This may seem like a lot of work - to write a file, read it, play it and then discard it, often to do something that you'd think scripting should do in the first place.

 

Sometimes the action alone is enough to satisfy an objective - such as changing the document color mode. Other times it is necessary to alter actions in order to get use out of them - such as when you try to create a routine for saving a high-resolution "Export" JPG that is different in output and options form the "Save for Web" JPG. You may want to change some of the parameters such as resolution or the actual destination of the file.

Here is how you can do this.

 

First, record your action as you would normally: record a new set with a new action, call them what you need and then in the Actions flyout menu, save out a .aia file where you can find it. You can open the file in a text editor and read the contents - they are lines of special Actions 'code' which contains some cryptic text.

There are lines which look like a bunch of gibberish characters, they are hex-encoded strings for some parameter item which are strings, and they contain above them a number to signify the amount of characters inside the encoded string. (this is important later because this number also needs to be set properly when you put your own value in there) Other parameter items are simple numbers, but their keys are still obscured.

The truth is, while the string parameters are hexadecimal-encoded, the keys are both hexadecimal and decimal encoded! So if you wanted to know the special 4-letter keys, you'll have to run those through two decoder routines.

 

Next, you will need to put this entire string into your script and use some string-replacement or string-building to put your own data in those places of the action string where they matter. For example, putting your own file path into a save action.

 

And, after that you need to write a procedure for writing this new altered string to the file system and loading it into your Actions panel. Mind you, to leave things "as they were" you would need to remove the .aia file and the action that you have loaded.

 

Let's try with the save-a-jpeg workaround!

Here is the .aia string which is recorded from an Export JPEG action.

 

Screen Shot 2017-02-10 at 3.04.33 PM.png

/version 3

/name [ 8

  5475746f7269616c

]

/isOpen 1

/actionCount 1

/action-1 {

  /name [ 11

  4578706f7274204a504547

  ]

  /keyIndex 0

  /colorIndex 0

  /isOpen 1

  /eventCount 1

  /event-1 {

  /useRulersIn1stQuadrant 0

  /internalName (adobe_exportDocument)

  /localizedName [ 9

  4578706f7274204173

  ]

  /isOpen 1

  /isOn 1

  /hasDialog 1

  /showDialog 0

  /parameterCount 7

  /parameter-1 {

  /key 1885434477

  /showInPalette 0

  /type (raw)

  /value < 100

  0a00000001000000030000000200000000002c01020000000000000001000000

  69006d006100670065006d006100700000006f00630000000000000000000000

  0000000000000000000000000000000000000000000000000000000000000000

  00000100

  >

  /size 100

  }

  /parameter-2 {

  /key 1851878757

  /showInPalette 4294967295

  /type (ustring)

  /value [ 25

  2f55736572732f566173696c7948616c6c2f4465736b746f70

  ]

  }

  /parameter-3 {

  /key 1718775156

  /showInPalette 4294967295

  /type (ustring)

  /value [ 16

  4a5045472066696c6520666f726d6174

  ]

  }

  /parameter-4 {

  /key 1702392942

  /showInPalette 4294967295

  /type (ustring)

  /value [ 12

  6a70672c6a70652c6a706567

  ]

  }

  /parameter-5 {

  /key 1936548194

  /showInPalette 4294967295

  /type (boolean)

  /value 1

  }

  /parameter-6 {

  /key 1935764588

  /showInPalette 4294967295

  /type (boolean)

  /value 1

  }

  /parameter-7 {

  /key 1936875886

  /showInPalette 4294967295

  /type (ustring)

  /value [ 1

  32

  ]

  }

  }

}

 

We can see many parameters and their various cryptic blocks, but what you want to do is decode as many /type (ustring) elements as possible to get a sense of what the action is doing. At this website, you can do this fairly easily although tediously: Convert Hexadecimal To String Online

For example: "4a5045472066696c6520666f726d6174" turns into "JPEG file format".

In this action example, I am not worried about changing the other parameters dynamically - I'm assuming the settings used in my action are suitable for my purposes such as resolution being 300 for all time. The part I'd like to change is my file path so that my JPEG goes to the right place.

/value [ 25
2f55736572732f566173696c7948616c6c2f4465736b746f70
]

This line yields: "/Users/VasilyHall/Desktop"

So this is the line I'll need to replace.

 

Before anything else - here is how I'd embed the action string with ease. Using a text editor like Sublime text which lets you put many cursors down at one time, I can paste the action string in and find every nextline character. Then it's easy to highlight each line and put quotes around it as well as a comma in the end, or plusses - depending if you want to store the string as an array or a plain string in the script.

Screen Shot 2017-02-10 at 3.16.48 PM.png

I find the plusses a little cluttering so I opt to use this format:
var actionString = [     "string",

     "string"

].join("\n");

 

So my dynamic portion of the string which will be used with string replacement would look like this:

 

"  /value [ {{number_of_characters}}",

"  {{hex_encoded_path}}",

"  ]",

 

When the action is ready to be dispatched, a string replacement would look like this:

var myNewPath = Folder.myDocuments.toString() + "/Destination";

var myNewPathEncoded = hexEncode(myNewPath); // find a hex encode function via google
var thisActionString = actionString.replace("{{hex_encoded_path}}", myNewPathEncoded).replace("{{number_of_characters}}", myNewPath.length);

 

Now it's time to write the file.

var f = File(actionFileLocation);

f.open('w');

f.write(thisActionString);

f.close();

 

And now it's time to load the action.

app.loadAction(actionFileLocation);

 

Now we can play the action.

app.doScript("Export JPEG", "Tutorial");

 

This should save your jpeg, and as of this writing, this is the only way to get the JPEG export which isn't the Save-for-Web variety.

But, let us not forget the cleanup.

 

Remove the .aia file:

f.remove();

 

Remove the single-use dynamic action:

app.unloadAction("Tutorial", "");

 

There you have it: building dynamic actions to do simple and non-simple things, which regular scripting just can't do.

Cant install extend script

$
0
0

So I am not sure if this is the proper location for this. I posted in the javascript forum and was told to try here. I also searched the forums and could not find a good support answer. So I use Creative cloud at work, but I can not seem to download the extend script program. I had it installed and have been having no problem. All of a sudden I get random crashes from the extend script and Now I can no longer open it. I downloaded the only version I could find (3.5) and when I try to install it it tells me I am missing a file and to download a "Adobe Service Advisor" the two longer exists. any idea what I can do? also I am on Mac and I have already cleared out everything I could find about extend script on the computer. Also it no longer shows up in the creative cloud app.

Replacing Text MRAP

$
0
0

Any reason I would be getting an MRAP error on this snipit?  I have used this forever and just recently its been kicking back MRAP.

 

var Number = "123456";

function AddTextToFrame(num){

    var idoc = activeDocument;

    var text = idoc.textFrames;

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

        if(text[i].contents == "99999"){

            text[i].contents = num;

        }

    }

};     

AddTextToFrame(Number);

get scale (h, v)

$
0
0

Hi,

 

I need help, I need to know the scale percentage of the image placed in illustrator. I can get it from matrix,  but after I rotate the image,  everything changed. What I need is exactly the same what I see in Link Information  " scale (h, v)"    - this when you double click the image from the link panel.

 

 

Thank you.


Javascript file names on Mac

$
0
0

Hi All:

I have a javascript that creates new files on windows and mac.  On the windows side it creates a file name ok and calls it B5177-123-My style.ai

on the mac side the same exact script pulled from same location creates a file name that on the Mac looks similar except it includes the last folder name I told it to store in so if desktop it will store it one folder level up and call it desktop\B5177-123-My style.ai  but if I copy it to our mutual win/mac server the file name shows up as D23458A~.ai

 

Any help would be greatly appreciated.  Script is included if that helps.   I bolded the section that is most likely causing the problem.

 

THanks,

 

Ron

 

#target illustrator

//  for this code to work it must have 12 items in each row seperated by tabs.

// items are  order#,custcd,customer name, style-colour, style desc,colour,emb type, placement,unused,unused,style file name including path,comments, embcode

// 0 1      2 3       4 5   6 7    8 9      10 11 12

function testBtnOnClick() {

  

   // this.parent.buildBtn.enabled = true;

    //this.parent.make1Btn.enabled = true;

var dlg = this.parent.parent;

    var mydata = calculateApprovalsVG(this.parent.parent.msgEt.text);

//var data = showdata(mydata);

    //var data = mydata;

    //    debugger;

    //dlg.dataStore = mydata;

//dlg.CADLoc = parseCADLoc(dlg.msgCAD.text);

//fillList(dlg, data);

    }

// pick folder for saving completed forms

// what is this?  looks same as routine above

 

 

 

 

function main() {

var thisC = this;

    this.dlg = new Window('dialog', 'Paste document data below');

this.dlg.dataStore = new Array();

this.dlg.CADLoc = new Array();

     this.dlg.size = {width: 1000, height: 570};

     this.dlg.msgEt =  this.dlg.add('edittext', undefined,  '', {multiline:true});

    this. dlg.msgEt.size = {width: 970, height: 500};

//this.dlg.msgCAD =  this.dlg.add('edittext', undefined,  '<CAD Location Data>', {multiline:true});

    //this. dlg.msgCAD.size = {width: 970, height: 100};

//this. dlg.msgCAD.alignment = 'left';

//this.dlg.listBox =  this.dlg.add('listbox', undefined, 'formListBox', {multiselect:true});

//this.dlg.listBox.alignment = 'right';

//this.dlg.listBox.size = {width: 970, height: 200};

//this.dlg.listBox.alignChildren = 'top';

//this.dlg.listBox.formItems = new Array();

     this.dlg.btnPnl =  this.dlg.add('panel', undefined, );

     this.dlg.btnPnl.orientation = 'row';

     this.dlg.btnPnl.alignment = 'right';

     this.dlg.btnPnl.testBtn =  this.dlg.btnPnl.add('button', undefined, 'Make All Forms')

     //this.dlg.btnPnl.buildBtn =  this.dlg.btnPnl.add('button', undefined, 'Make All Forms');

     //this.dlg.btnPnl.buildBtn.enabled = false;

//'this.dlg.btnPnl.make1Btn =  this.dlg.btnPnl.add('button', undefined, 'Make Selected Forms');

     //'this.dlg.btnPnl.make1Btn.enabled = false;

     //'this.dlg.btnPnl.make1Btn.onClick = make1BtnBtnOnClick;

     this.dlg.btnPnl.cnclBtn =  this.dlg.btnPnl.add('button', undefined, 'Done', {name:'cancel'});

     this.dlg.btnPnl.testBtn.onClick = testBtnOnClick;

     //this.dlg.btnPnl.buildBtn.onClick = buildBtnOnClick;

this.dlg.show();

}

 

 

 

 

// Saves the current document to dest as an AI file with specified options,

// dest specifies the full path and file name of the new file

function exportFileToAI (dest, docRef) {

    if ( app.documents.length > 0 ) {

        var saveOptions = new IllustratorSaveOptions();

        var aiDoc = new File(dest);

        saveOptions.compatibility = Compatibility.ILLUSTRATOR15;

        saveOptions.flattenOutput = OutputFlattening.PRESERVEAPPEARANCE;

        docRef.saveAs( aiDoc, saveOptions );

    }

}

 

 

 

 

 

 

 

 

//

//

//

//              *  validate the data and unless errors proceed now!

//

//

 

 

 

 

function calculateApprovalsVG(spreadsheet) {

               

            //var spreadsheet = document.barcodegen.spreadsheet.value;

var spreadsheetRows = spreadsheet.split("\n");

var columnArray = new Array();

var xx = 0;

 

var mydata = new Array();

var m = 0;

// Iterate over the rows and break them down into their columns

var spreadsheetRowsCols = new Array();

//var firstsize = 0;

//var isItSize;

               

for (var i in spreadsheetRows) {

spreadsheetRowsCols[i] = new Array();

spreadsheetRowsCols[i] = spreadsheetRows[i].split("\t");

                    xx = spreadsheetRowsCols[i].length

                      if(spreadsheetRowsCols[i].length<11){

                         

                    alert("Row "+ i + " must be 12 tabbed items in the list for this to work. Last good order was " +spreadsheetRowsCols[i-1][0],"Big problemo! On strike til you fix this!");

                    return;

                    

                    }

            //    if (spreadsheetRowsCols[i][9].exists){

              //      alert("File not found "+spreadsheetRowsCols[i][9] +" aborting!");

                //   }

                }

               

               

//     

// lets try and place the whole thing in here and make it use first array!

//

   

var destFolder = null;

destFolder = Folder.selectDialog( 'Please select the folder to save the forms to.', '~' );

    alert( destFolder );

var tempFile = null;

tempFile = File.openDialog( 'Please choose the template file.', '*.ai' );

   

if(tempFile) {

var theTemplate = tempFile.fsName;

for(var i in spreadsheetRows) {

if(spreadsheetRows[i] ){

//alert(i + ': ' + mainframe.dataStore[i]['client'] + ' - ' + mainframe.dataStore[i]['style']);

var theStyle = spreadsheetRowsCols[i][3];

var theCAD = spreadsheetRowsCols[i][9];

//alert(theStyle + ': ' + theCAD);

var notset;

if(theCAD == notset) theCAD = '';

makeSingleForm(spreadsheetRowsCols[i], destFolder, tempFile, theCAD);

}

}

}

               

               

               

               

               

             alert("Processing Complete","All files were created!");  

            }

 

 

 

 

function makeSingleForm(artformData, destFolder, theTemplate, theCAD) {

//alert(artformData[i]['scs']);

// File Name

// Point Text

//alert(theTemplate);

var docRef = open(theTemplate);

// Client y: 595 from bottom, 63

var pointTextClient = docRef.textFrames.add();

pointTextClient.contents = artformData[2];

pointTextClient.top = -65;

pointTextClient.left = 550;

pointTextClient.selected = false;

 

 

// Licensor Name

var pointTextStyle = docRef.textFrames.add();

pointTextStyle.contents = artformData[8];  // this needs to be fixed or dropped

pointTextStyle.top = -80;

pointTextStyle.left = 550;

pointTextStyle.selected = false;

   

// Order #

var pointTextStyle = docRef.textFrames.add();

pointTextStyle.contents = artformData[0];  // this needs to be fixed or dropped

pointTextStyle.top = -100;

pointTextStyle.left = 115;

pointTextStyle.selected = false;

   

// application - artwork code descriptions

var pointTextStyle = docRef.textFrames.add();

pointTextStyle.contents = artformData[6];

pointTextStyle.top = -163;

pointTextStyle.left = 96;

pointTextStyle.selected = false;

 

 

// artwork code EMB Code

var pointTextStyle = docRef.textFrames.add();

pointTextStyle.contents = artformData[11];

pointTextStyle.top = -65;

pointTextStyle.left = 116;

pointTextStyle.selected = false;

 

// Comments

var pointTextStyle = docRef.textFrames.add();

pointTextStyle.contents = artformData[10];

pointTextStyle.top = -125;

pointTextStyle.left = 60;

pointTextStyle.selected = false;

 

// Placement

var pointTextStyle = docRef.textFrames.add();

pointTextStyle.contents = artformData[7];

pointTextStyle.top = -150;

pointTextStyle.left = 95;

pointTextStyle.selected = false;

 

 

// Garment: Style / Colour / Size Breakdown

var pointTextStyle = docRef.textFrames.add();

pointTextStyle.contents = artformData[3]+" "+artformData[4] +" "+artformData[5];

pointTextStyle.top = -80;

pointTextStyle.left = 116;

    //pointTextStyle.width = 100;

    //pointTextStyle.height = 40;

pointTextStyle.selected = false;

 

    // Product colour

//var pointTextColor = docRef.textFrames.add();

//pointTextColor.contents = artformData[5];

//pointTextColor.top = 95;

//pointTextColor.left = 203;

//pointTextColor.selected = false;

/*

var pointTextBreakdown = docRef.textFrames.add();

pointTextBreakdown.contents = artformData['scs']['breakdown'];

pointTextBreakdown.top = 453;

pointTextBreakdown.left = 311;

pointTextBreakdown.selected = false;

redraw();

*/

if (theCAD != '') {

//alert(theCAD);

       //  if (theCAD.exists){

 

 

 

 

 

 

 

 

var cadRef = open(File(theCAD));

doc=activeDocument;

for (i=0; i<doc.layers.length; i++){doc.layers[i].hasSelectedArtwork=true;} // select all

copy();//

doc.close( SaveOptions.DONOTSAVECHANGES );

docRef.layers.add();

        docRef.activeLayer = docRef.layers.getByName("Layer 2");

 

        

paste(); //

// end original code

 

 

 

 

//}else{

 

 

//alert(theCAD+" File can't be located for "+artformData[0] );

//return

//}

 

}

 

var dest = destFolder + "\\" + artformData[1] + '-' + artformData[3] + '.ai';

//alert(dest);

exportFileToAI (dest, docRef) ;

docRef.close( SaveOptions.DONOTSAVECHANGES );

}

var mainframe = new main();

Evenly Select Anchor Points

$
0
0

Hi,

I would like to select every n(th) anchor points of select path(s).

screenshot.jpg

I found a script tried to modify it I am able to remove every 2nd anchor point but what I really want is to select them. (And surely there is a better way to do this.)

 

main();
function main(){  if(documents.length < 1) return;    var s = activeDocument.selection;  if(!(s instanceof Array) || s.length < 1) return;  var paths = [];  extractPaths(s, 0, paths);  var p, j;  for(var i = paths.length - 1; i >= 0; i--){    p = paths[i].pathPoints;    totalpoint = p.length;    //alert (totalpoint);    for(j = totalpoint - 1; j >= 0; j--){        if ( j  && (j  % 2 === 0)) {            p[j].remove();            //p[j].PathPointSelection.ANCHORPOINT.isSelected = true ;            }   }    if(p.length < 2 && isSelected(p[0])) paths[i].remove();  }  redraw();
}


// ----------------------------------------------
function isSelected(p){ // PathPoint
  return p.selected == PathPointSelection.ANCHORPOINT;
}


// --------------------------------------
function extractPaths(s, pp_length_limit, paths){
  for(var i = 0; i < s.length; i++){    if(s[i].typename == "PathItem"){            if(pp_length_limit > 0         && s[i].pathPoints.length <= pp_length_limit) continue;      paths.push( s[i] );          } else if(s[i].typename == "GroupItem"){      extractPaths( s[i].pageItems, pp_length_limit, paths);          } else if(s[i].typename == "CompoundPathItem"){      extractPaths( s[i].pathItems, pp_length_limit, paths);    }  }
}

 

Thank you for your help.

Installing Scripts in latest Illustrator CC release (V 22.0.1)

$
0
0

Hi all,

 

I have been trying to find the location for installing scripts so that they appear directly under File > Scripts (instead of having to navigate to them via File > Scripts > Other Scripts). However, i can't find a folder for them.

 

In AI CC 2017 the folder was (on Windows) "C:\Program Files\Adobe\Adobe Illustrator CC 2017\Presets\de_DE\Skripten"

There seems to be no similar folder in the CC 2018 install. I tried "C:\Program Files\Adobe\Adobe Illustrator CC 2018\Support Files\Contents\Windows\Scripts"

and also "C:\Program Files\Adobe\Adobe Illustrator CC 2018\Scripting"

But scripts placed in either of these folders do not show up under File > Scripts, even after restarting Illustrator.

 

I couldn't find any official documentation regarding installing scripts in AI CC 2018. Does anyone have an idea where scripts go in the new release?

Thanks in advance!

Does the updated Pantone library affect how Illustrator sees them as spot colors?

$
0
0

HI, I work for a print shop down in New Orleans.

 

I inspect and print films before they are burned onto a screen. Before I print the films I normally would create spot colors in Illustrator from the values of our custom inks or use the Solid Coated Pantone book.

 

Both colors would show up fine in the print box. Now, once I use the updated Pantone list that I downloaded from Pantone.com after ordering the Plus Series Pantone book I can not see the pantons listed anymore int he print box. Is this a common issue?

 

Has anyone come across this issue before? The way I go about fixing it would be to convert the Pantone to a CMYK and create a spot color using the same name as the Pantone. It works now but it can be time-consuming.

 

If there is a better fix around please let me know.

 

Thanks

Embed Color Profile

$
0
0

While exporting to Tif, below code doesn't have any effect. can anyone please suggest on this.

 

exportOptions.embedICCProfile =true;

Viewing all 3671 articles
Browse latest View live


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