Quantcast
Viewing all 12845 articles
Browse latest View live

Relink many files at once

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

 

#target Illustrator

 

// script.name = relinkAllSelected.jsx;

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

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

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

// script.elegant = false;

 

var idoc = app.activeDocument;

sel = idoc.selection;

if (sel.length>0)

     {

        

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

               {

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

                        {

     

                            var iplaced = sel[i];

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

                            iplaced.file = file;

                         }

               }

     }

else

     {

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

     }

 

 

 

 

 

 

and I get an

 

error 25:  Expected: }.

Line:10

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

 

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

 

 

Thanks

Marcus


Illustrator Find And Replace

Hi there,

 

Can anybody tell me if it's possible to JavaScript Illustrators Find And Replace text function?

 

I know it's possible in InDesign but I can't find anything for Illustrator.

 

Many Thanks,

Nik

Edit TextFrame through Window'Palette' call back function

Hello,

 

working on Illustrator and ESTK.

I set a window to ask the user for inputs, then when he clicks OK I'd like to use the data to fill textFrames on a document.

My code seems logic to me but it dosen't work, any ideas why ?

 

Thanks !

 

#targetengine'foo';

var BAT = app.activeDocument;

 

// FUNCTIONS

function EditTextFrames (document, client) {

    var clientTextFrame = document.textFrames.getByName("client");

    clientTextFrame.contents = client;

}

 

//// WINDOW MODEL ////

function BatWindow () {

     var win = new Window ('palette', 'EditBAT');

 

    // ENTRIES

    var clientGroup = win.add ("group");

    clientGroup.add ("statictext", undefined, "Client:");

    var clientText = clientGroup.add ("edittext", undefined, "");

    clientText.characters = 30;

 

    // BUTTONS

    var myButtonGroup = win.add ("group");

    myButtonGroup.alignment = "right";

    var ok_button = myButtonGroup.add ("button", undefined, "ok");

    ok_button.onClick = function () {

        EditTextFrames (BAT, clientText.text);

    }

    var cancel_button = myButtonGroup.add ("button", undefined, "cancel");

    cancel_button.onClick = function () {

        win.close ();

    }

    clientText.active = true;

    return win;

}

 

//// INSTANTIATE WINDOW ////

 

var window = BatWindow ();

window.show ();

undefined is not an object error message

Hi there.

  I'm just new to scripting in illustrator.  actually, i'm new to illustrator too!

but i do have a programming background.  right now, i'm just trying to familiarize myself with scripting for illustrator files.

i have an svg file that was created by our artist.  i've opened that file in illustrator.  i've also opened a sample javascript from adobe called "makelineargradient" and i'm trying to run this script against the svg file.

it worked fine the first time. but on subsequent compiles / runs, i'm getting the error message "undefined is not an object"

 

the line it's failing on is line 1:

if (app.documents.length > 0)

 

can someone point me in the right direction?  I'm using the extendscripts tool to open and run the javascript file.

Calling functions from UI palette

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!

Illustrator JPEGExportOptions Object properties are missing in Object Model

Having trouble with a script selecting elements that are part of an envelope distort.

Hello, first time posting I hope I'm doing this correctly.

 

Basically, I have a file that requires a text change which is then exported and edited in Photoshop. I recently have started experimenting with Envelope Distorts as it offered me better control over the span of my documents text areas, however when I run my script on the document, it fails to catch any text that is wrapped with an Envelope Distort. I'm assuming it's because the script is searching for textFrames and when part of an Envelope Distort text becomes something else.

 

Thanks!

Adding Artboards ?

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


Access Separations Preview Panel

Hi Forum,

 

Im new to illustrator scripting.

 

Would anybody help me to access "Separations preview panel"  through script.

 

thanks.

 

looking forward for your fabulous support on my request.

 

 

thanks.

How Can I See Javascript Script Debugging In Adobe Illustrator CC 2015.0.0?

I have written a Javascript script to run in Illustrator so that it can create particular irregular polygon paths for me when I need it. Some of the lines being drawn are not what I was expecting and it's at this point that I would usually add some debugging lines into my code to see what's what. As far as I can tell, in Adobe Illustrator, I need to add the lines

 

$.write(myValue);

$.writeln(myValue);

 

In the past, when using previous version of Adobe Illustrator, I can recall a window appearing with my debugging in it. On this current version:

 

v2015.0.0

 

I cannot seem to find it anywhere. I have googled this question a bit and I have only come away more confused. How can I see my debugging for my simple script? Do I need a plugin? Can anyone recommend one?

 

Thanks,

Phedg1

Illustrator Find And Replace

Hi there,

 

Can anybody tell me if it's possible to JavaScript Illustrators Find And Replace text function?

 

I know it's possible in InDesign but I can't find anything for Illustrator.

 

Many Thanks,

Nik

Repeating Script based on Hot folder content

I have a script that is ran based on contents of a Hot folder I've created.. The script works flawlessly when placing one file at a time... but I'd love to be able to fix it so that I can drop multiple files in and it repeat the script on each individual file until all files have been processed. Thanks in advance for any help.

 

#target illustrator

var fo = Folder ( '~/Desktop/Illustrator Hot Folder/Reveal Zund Marks/IN' ); 
var files = fo.getFiles ( /* you may want to use a filter function here. See doc */ ); 
var file, newimage;  
file = files.pop();

app.open(file);

//Through Cut Forward
function wrapper()
{
     var docRef = app.activeDocument;     var layers = docRef.layers;     var artLayer = layers["Artwork"];     var thruCutLayer = layers["Through Cut"];        function bringThruCutForward()     {          thruCutLayer.zOrder(ZOrderMethod.BRINGTOFRONT);     }     function sendThruCutBackward()     {          thruCutLayer.zOrder(ZOrderMethod.SENDTOBACK);     }     bringThruCutForward();
}
wrapper();

saveAsPdf(     '~/Desktop/Illustrator Hot Folder/Reveal Zund Marks/OUT',     'Proof' + activeDocument.placedItems[0].file.name,     "Dynagraphics PDF - Flat - Layers" 
); 
/**
 * sample save the activeDocument to the pdf file
 *
 * @param {String} targFoldPath - any destination folder path
 * @param {String} targFileName - the activeDoocument.name or any another name
 * @param {String} pdfPresName - the name of existing pdf preset
 * */ 
function saveAsPdf(targFoldPath, targFileName, pdfPresName) {   var destFolder    = new Folder(targFoldPath);   var pdfOpts       = new PDFSaveOptions();   pdfOpts.pDFPreset = pdfPresName;   var targFile      = new File(destFolder + '/' + targFileName);   activeDocument.saveAs(targFile, pdfOpts); 
} 

//Close the open Document Command
app.documents[0].close(SaveOptions.DONOTSAVECHANGES)

//This line is set to clear the file out of the HotFolder when complete... Works great
 var myFolder = Folder('~/Desktop/Illustrator Hot Folder/Reveal Zund Marks/IN' );
 var myFiles = myFolder.getFiles();
 for(var i=myFiles.length - 1; i > -1;  i--){
 myFiles[i].remove();  };

Repeating Function dependent on number of items selected

I'm building a script that will allow me to Open a .pdf and copy it's contents and layers into another existing document (template) I have set up... I want to be able to center these on the document (template) I have but depending on the .pdf file there could be 1 layer up to 3 or more... so I want the function to repeat until all layers have been centered. The script I've posted below will handle two layers, but in the even a second layer is not present or more than 2 are... I need the function to behave correctly... I know I'm missing a simple step somewhere, but not sure what... Thanks in advance for any assistance.

 

//Center Placed Image on Artboard
var aDoc = app.activeDocument; 
app.coordinateSystem = CoordinateSystem.ARTBOARDCOORDINATESYSTEM; 
var abIdx = aDoc.artboards.getActiveArtboardIndex(); 
var actAbBds = aDoc.artboards[abIdx].artboardRect; 
var obj2move = aDoc.selection[0];
obj2move.position = new Array ((actAbBds[2]-actAbBds[0])/2 - obj2move.width/2, (actAbBds[3]-actAbBds[1])/2  + obj2move.height/2);
var obj2move = aDoc.selection[1];
obj2move.position = new Array ((actAbBds[2]-actAbBds[0])/2 - obj2move.width/2, (actAbBds[3]-actAbBds[1])/2  + obj2move.height/2);

launch illustrator with script from commandline

Hi,

(Illustrator CC 2014 on Windows 7)

 

I had hotkeys defined using AutoHotkey to execute a script in illustrator by executing a commandline, and with the script as an argument. This used to work fine, but it has suddenly stopped working for me, maybe with one of the latest Illustrator CC updates...

 

The command-line looks something like:

"C:\Program\Adobe\Adobe Illustrator CC 2014\Support Files\Contents\Windows\Illustrator.exe" "c:\pathtoscript\myscript.jsx"

Now Illustrator just sits there and nothing happens!

 

Has anyone else seen this? Can someone confirm if this worked in previous versions and also confirm that it doesn't in the latest, please?

 

Thanks!

Duplicate an outline path?

I have a client who has some Styles they're still using from the pre-CS5 era which have "add arrowhead" appearance styles, but these no longer work in Illustrator CC 2015.3 (actually, existing paths are rendered correctly, they just can't duplicate/move/re-apply). The styles basically implement a solid path with an arrowhead, and an outline/border of a different color. This wasn't possible to replicate in Illustrator CC 2015.3 as arrowheads didn't align correctly, but we can replicate it in Illustrator CC 2017 by converting the path with arrowhead to an outline and duplicating it (solid filling one, and applying an outline stroke to the other).

 

It's a more involved process than just a style (their old style applied multiple strokes with multiple "add arrowhead" appearances, so it was implemented entirely as a style), but I believe it's scriptable.

 

I seem to reasonably be able to convert a selected path (with an arrowhead, in this case) to an outline as follows:

app.executeMenuCommand("Live Outline Stroke");

app.executeMenuCommand("expandStyle");

However, I can't seem to then be able to reliably duplicate that pathGroup to then apply different appearances to each. If I iterate over the pathItems in the newly-selected groupItem and duplicate as follows:

var newPath = aPath.duplicate(theGroup, ElementPlacement.PLACEATEND);

I end up with a copy of the originally-selected path (though I've verified it's a groupItem) with some apparently empty additional groupItems.

 

I must admit that while I am a JavaScript developer and can find my way around Illustrator, I'm not an Illustrator pro and so don't quite understand some of the gotchas (esp. since Adobe's JavaScript reference documentation doesn't have a whole lot in the way of examples). What might I be missing here?


Access Gradient Mesh Points

I'm hoping someone at Adobe can help me. I must access the points of a gradient mesh the Illustrator scripting guide doesn't permit this, is there a work around someone can suggest ?

How to get the angle of an object ?

How do I save a .DXF file in Illustrator as an AI file using VBscript?

I have a VBA script that opens a .DXF file in Illustrator, and want to save it as an AI file. How do I do this?

Is it possible in Extendscript/Javascript to 'Outline Stroke' a path

I'm trying to achieve the same command as enacted by Object > Path > Outline Stroke.

 

I can't find any reference to a method for this in the Javascript reference PDF, and you can't trigger menu commands in Javascript.

 

Applescript allows you to access the menu commands, so I wrote this:

 

tell application "Adobe Illustrator"

    set thisDoc to current document

    set locked of layer ("walls") of thisDoc to false

   

end tell

 

tell application "System Events"

    click menu item "All" of menu "Select" of menu bar item "Select" of menu bar 1 of process "Adobe Illustrator"

       

    click menu item "Outline Stroke" of menu "Path" of menu item "Path" of menu "Object" of menu bar item "Object" of menu bar 1 of process "Adobe Illustrator"

   

end tell

 

But it has a very annoying problem: if you run the script form within Illustrator the 'Outline Stroke' command fails. But, if you run the script in the Applescript editor with the illustrator document open it works. Which is just plain weird. If anybody understands why this is the case I'd love to hear the reason (and fix).

 

If anybody has any ideas for successfully outlining strokes in either Javascript or Applescript please respond.

 

Thanks,

 

Barry

Script to make multiple layers in one task

From time to time I find the need to make many empty layers named A-Z. I use this when preparing a font drawn in Illustrator for moving to FontLab.

I have not found any ready made script to do this and would like a little help to make one. Or, if somebody would like to make this script it would be even more helpful.

The situation is this:
A full set of glyphs is ready in Illustrator and all are on Layer 1.
Artboard is set according to: http://font.is/?p=48
Glyphs are aligned to left on top of each other.
Need to make empty layers, A-Z and even more. Tedious by hand.
Then each glyph is moved from the sublayers to their own new layers. I could continue doing this part by hand.

I could of course make these layers in one file and copy them each time to each project but a script would be soooo much cooler.

Any help with this? Hints?

Thanks in advance.
Viewing all 12845 articles
Browse latest View live


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