Linking FileInfo Panel to an Illustrator Script

I've got an Illustrator script (Javascript) that writes XMP based on the content of the artwork, but the script has to be manually triggered. I've got a custom FileInfo panel (built with Flex/AS3) to help me edit the XMP once stored.
I'd like to combine the two, so the Script fires whenever the FileInfo panel opens.
I can't do the DOM scripting directly in AS3, can I? I think that Illustrator is only open to Javascript, VB, and AppleScript. Please correct me if I'm wrong.
Does anyone have any ideas how to call the javascript in the Scripts folder from an event in the FileInfo panel's SWF, and pass arguements back and forth? I've seen it done on webpages, but only when both the SWF  and javascript are on the same HTML page.
Thanks

Thanks Carlos, this led me in the right direction, but not quite far enough.
I found Zac's Cookbook on jsxInterface, but it isn't working for me. I've set up the project linking the SWCs as directed by the SDK (csaw, apedelta, etc.), but when I use his code, I get error 1120 access of undefined property error.
I think I've imported all of the classes that I need. I'm thinking that I might have the javacript in the wrong folder of my project (although I've tried it in several, its in the src folder of the project with the mxml file), or that the javascript itself isn't valid (I've checked that it is).
Any ideas what I'm missing to make this work?
Thanks,
Alex
import com.adobe.csawlib.*;
import com.adobe.illustrator.Application;
[Embed (source= "myScript.jsx" , mimeType= "application/octet-stream" )]
private static var myScriptClass:Class;
var jsxInterface:HostObject = HostObject.getRoot(HostObject.extensions[0]);
jsxInterface.eval(new myScriptClass().toString())

Similar Messages

  • Combining a Flex FileInfo panel for Illustrator with an Illustrator Javascript

    I've got an Illustrator script (Javascript) that writes XMP based on the content of the artwork, but the script has to be manually triggered. I've got a custom FileInfo panel (built with Flex/AS3) to help me edit the XMP once stored.
    I'd like to combine the two, so the Script fires whenever the FileInfo panel opens.
    I can't do the DOM scripting directly in AS3, can I? I think that Illustrator is only open to Javascript, VB, and AppleScript. Please correct me if I'm wrong.
    Does anyone have any ideas how to call the javascript in the Scripts folder from an event in the FileInfo panel's SWF, and pass arguements back and forth? I've seen it done on webpages, but only when both the SWF  and javascript are on the same HTML page.
    Thanks

    Hi Hui
    Well, sort of, although I've made a bit more progress now and the events part seems to be working.
    I originally thought that fPPLib was specifically for Flex/Flash but I now realise that it is the main PlugPlug interface (which now includes HTML5 panels - right?)
    I think what I really need is HTML5 panels 101 (for Illustrator). The exmples in this forum are InDesign specific and all the c++ libraries are different. Also nothing I've seen so far shows how to make an extension work from within Illustrator's menus (as opposed to just from Window->Extensions).
    I have a plugin which requires input parameters from the user.
    What I am trying to do is.
    1) Create an HTML5 extension panel which will collect values from the user.
    2) Attach that panel (or is it a modal dialog) to say Object->Filters in the main Illustrator menu
    3) Have that panel load previous plugin parameters (*from the current session)
    4) Validate the user values in the panel.
    5) Make the panel communicate those values to the plugin
    6) Show/Hide the panel as required (i.e. open it from a menu item, close it when done).
    Also, in the original flash panel which I am trying to adapt, there is a lot of ActionScript in the mxml file.
    Where does all that go now? Is that what ExtendScript is for (and if so are there some useful tutorials on it anywhere?)
    I know that is a lot of questions. Apologies - I'm new to this and impatient to make some real progress.
    Cheers,
    Rob

  • Errors and more, my first illustrator script

    First, I should mention that I started scripting for Photoshop about a month ago and have had some really motivating successes there. It led me to this one task we have that is just incredibly repetitive and boring in Illustrator that I want to script.
    I haven't gotten all the pieces in here that I need so far, and any form of help would be greatly appreciated, whether just suggestion, or really whatever. I don't mind doing research and trying things out myself.
    The purpose of this script is to open a template file we have on our network drive, ask for a folder with a collection of files (these are files provided to us that contain the info we need to make labels), place one, save with a specific name, and start over, placing the next file, till they are all on the template. We do this before we can create labels for our products. There are weeks when it has to be done 50+ times and that's pretty mind-numbing.
    The steps I think I need are:
    ask where the provided files are that need to be placed
    open template file
    make sure the folder chosen has the right type of stuff in it (PDFs)
    place the first file at specified coordinates
    embed the link
    lock the embedded link
    ask user to proof information on screen (ok to continue, cancel to stop and let user interact with file on their own) (95% of the time, there are no errors)
    use the embedded link's name as the name of the file and save it to a specific network location
    repeat until all the files in the chosen folder have been done
    I've been lurking around here for a couple days, reading up on how Illustrator works with scripting and have broken off bits and pieces of different scripts to adapt for my purposes. So far, this is what I've come up with:
    function getLabelRequests() {
         return Folder.selectDialog('Please select the folder containing label requests:', Folder('~/Desktop'));
         function placeLabelRequests(selectedFolder) {
              var myDoc;
              if (selectedFolder) {
              var fileRef = File("/Volumes/myNetworkLocation/myTemplateFile.ai")
              open(fileRef);
              myDoc = app.activeDocument;
              var firstImageLayer = true;
              var thisPlacedItem;
              // create document list from files in selected folder
              var fileList = selectedFolder.getFiles();
              for (var i = 0; i < fileList.length; i++) {
              // open each document in file list
              if (fileList[i] instanceof File) {
              // get the file name
              var fName = fileList[i].name;
              // check for supported file formats
              if( (fName.indexOf(".pdf") == -1)) {
                   // skip unsupported formats
                   continue;
                   } else {
                        // Give the file the name of the image file
                        File.name = fName.substring(0, fName.indexOf(".") );
                        // Place the label request on the artboard
                        thisPlacedItem = myDoc.layers['Job Form'].placedItems.add();
                        thisPlacedItem.file = fileList[i];
                        thisPlacedItem.position = [15,-45];
                        thisPlacedItem.embed();
         if( firstImageLayer ) {
         // display error message
         alert("Sorry, but the designated folder does not contain any recognized image formats.\n\nPlease choose another folder.");
         myDoc.close();
         getLabelRequests (placeLabelRequests());
         else {
         // display error message
         alert("Rerun the script and choose a folder with label requests, if you please.");
    // Start the script off
    placeLabelRequests (getLabelRequests ());
    So obviously there's no loop in there, which is one of my problems at this point. I know what each of these chunks of code do, but can't necessarily understand all the syntax. Particularly things like
    for (var i = 0; i < fileList.length; i++) {
    I know it's saying that the variable i is zero, and while the list of files is greater than i, do whatever that last bit means, but I don't really know why it works or how it was constructed originally.
    I haven't specified the save either, which might be why I'm running another of my problems, but I don't know how to get the name of the link to be the name of the file when it's saved. I also haven't given it a confirm to let the user proof either.
    Here's my list of problems:
    Running the script returns the image format error, even though the folder selected contains PDFs (I suppose I don't need to confirm the files are PDFs, that could just be incumbent upon the user)
    Running the script places all the files into one iteration of the template (this may be because I haven't gotten the save or the loop in there, but I think it has more to do with the function being set up the way it is)
    Obviously, it doesn't save with the link name as the file name
    I don't seem to be able to figure out how to lock the link after it's embedded.
    I also wonder if there's a way to, rather than opening-placing-saving-closing-repeat, to open-place-save, delete-placenext-save, delete-placenext-save.
    Phew, sorry for the short novel.
    Here is a copy of the template … or not. Can I not embed files in the post that aren't images?
    Here's a JPG of the AI file that I use as a template
    This document has two layers in this order normally:
    Artwork
    Job Form
    And here are the blocks I'm using as placement for the information we are provided. These are taking the place of the files that need to be placed, and again, were PDF files, but I'm uploading as JPGs because I either don't know what I'm doing, or you can't upoad those file types.

    I worked around the place options for the PDF by adding in a function I found on this forum. It detects clipping masks and deletes them.
    There's one line in here that doesn't do anything, and I'm figuring out if it needs to be changed. After the clipScan function runs, I'm telling Illustrator to place a variable at a specific position, but because clipScan modifies the variable, it no longer recognizes that group of page items as the variable. Temporarily, I've used the original place position to make sure the link sits right where I want it to, but I have to make sure that the files we are provided never look any different.
    If they do, I'll need to asign a new variable and set the position after clipScan runs, I think. If it's necessary, I'll update with the fix, otherwise I think this is the final script.
    #target Illustrator
    app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;
    function getLabelRequests() {
        return Folder.selectDialog('Please select the folder containing label requests:', Folder('~/Desktop'));
    function placeLabelRequests(selectedFolder) {
        var myDoc;
        if (selectedFolder) {
            var fileRef = File("/Volumes/graphics/Standards/Job Forms/Label Job Form-5C.ai")
            var thisPlacedItem;
            // create document list from files in selected folder
            var fileList = selectedFolder.getFiles("*.pdf");
            for (var i = 0; i < fileList.length; i++) {
                // open each document in file list
                if (fileList[i] instanceof File) {
                    //open job form
                    open(fileRef);
                    myDoc = app.activeDocument;
                    // Place the label request on the artboard
                    thisPlacedItem = myDoc.layers['Job Form'].placedItems.add();
                    thisPlacedItem.file = fileList[i];
                    thisPlacedItem.position = [-50,10];
                    var myLinkName = myDoc.placedItems[0].file.name
                    thisPlacedItem.locked=true
                    thisPlacedItem.embed();
                    var clippingCount = 0
                    clipScan(myDoc)
                    thisPlacedItem.position = [15,-45];//this is the line that isn't doing anything right now.
                    redraw()               
                    //make sure the placed job form has the correct information
                    var proof = confirm ("Does the job form have the correct information?", true)//needs the redraw step above or nothing shows when the alert happens. Redraw forces Illustrator to display the actions performed so far.
                    if (proof) {
                        IllustratorSaveOptions = new IllustratorSaveOptions()
                        IllustratorSaveOptions.compatibility.ILLUSTRATOR15 //some of our printers have yet to upgrade
                        var onPO = Folder ('/Volumes/graphics/ •••Drafts•••/ • Draft Labels/ •On PO')
                        var saveFile = File(onPO + '/' + myLinkName);
                        myDoc.saveAs (saveFile, IllustratorSaveOptions)
                else alert ('Make note of the file with an error. This file will not be saved.')
                app.activeDocument.close (SaveOptions.DONOTSAVECHANGES)
        else {
            // if user cancels action, display message
            alert("Rerun the script and choose a folder with label requests.");
    // run the script
    placeLabelRequests (getLabelRequests ());
    //////////////////////////function to remove clipping paths from placed item, thanks to KennethWebb, Muppet Mark and CarlosCanto on the Adobe Illustrator Scripting forum.
    function clipScan (container) {
        for (i=container.pathItems.length-1;i>=0;i--) {
    var item = container.pathItems[i];
            if (item.clipping == true){ //screens for locked or hidden items (removed this after true:  && item.editable == true       so it no longer screens for locked or hidden items
                container.pathItems[i].remove();
                clippingCount++;

  • Using a repeater in a custom FileInfo Panel --data binding error

    When I developed a custom FileInfo panel in Flex Builder 3, I could use an array to populate a checkBox control inside a repeater, and it worked.
    Now, using Flash Builder 4, data binding with <mx:Repeater> doesn't seem to work, resulting in an empty fileInfo panel.
    When I remove the dataProvider from the <mx:Repeater> tag, my panel displays, but without the repeater. How can I specify the dataProvider in a different way that works?
    Thanks
    The code:
    <fi:XMPForm
              xmlns:mx="http://www.adobe.com/2006/mxml"
              xmlns:fi="com.adobe.xmp.components.*" width="100%" height="100%"
              label="TestPanel2_1" xmlns:s="library://ns.adobe.com/flex/spark" >
         <!-- Each namespace prefix that is used within an xmpPath-attribute,
              MUST BE registered at the top of EACH panel where it is referenced -->
         <fi:XMPNamespaces>
              <fi:XMPNamespace prefix="dc" value="http://purl.org/dc/elements/1.1/"/>
         </fi:XMPNamespaces>
         <mx:Script>
              <![CDATA[
                   import mx.collections.ArrayCollection;
                   [Bindable] public var newArray:Array =["One", "Two", "Three", "Four", "Five"];         
              ]]>
         </mx:Script>
         <fi:XMPFormItem>
              <mx:VBox id="primaryFrame" width="800">    
                   <mx:Repeater id="myRep" dataProvider="{newArray}">
                        <mx:Label text="{myRep.currentItem}"/>                  
                   </mx:Repeater>
              </mx:VBox>
         </fi:XMPFormItem
    </fir:XMPForm>

    Okay, I may have been making a rookie mistake. I see online reports that you can't bind an array to a repeater (even though it has worked for me).
    I've added the following variable to make my array an array collection:
    [Bindable] public var newArray2:ArrayCollection = new ArrayCollection(newArray);
    After changing the binding of the repeater to the new array and running the build, the fileInfo panel still does not function.
    Any thoughts?

  • Custom Fileinfo Panel Deploy folder seems to be wrong in SDK documentation

    Hi,
    I am working on to create custom tab for the FileInfo panel. In the sdk pdf it mentions that for windows the deploy folder is /user/<username>/appdata/adobe/xmp/Custom File Info Panels/3.0/panels. I deployed my panel there but nothing came up in Photoshop. I then deployed the custom tab into C:\Program Files (x86)\Common Files\Adobe\XMP\Custom File Info Panels\2.0\panels and it works.
    So, what is going on here? Is the deploy folder wrong in SDK? Or there is some way it should work from the first path (mentioned above)? Also, when I went to  /user/<username>/appdata/adobe/xmp there was no "Custom File Info Panels" folder. I had to create them manually. Does that indicate a problem?
    Thanks.

    Hi,
    no there is no problem, but the different suite version use different paths, so that they can live side-a-side:
    CS4 --> .../Custom File Info Panels/2.0/...
    CS5.x --> .../Custom File Info Panels/3.0/...
    On our SDK page (http://www.adobe.com/devnet/xmp.html), currently onle the CS5.x SDK is linked:
    http://download.macromedia.com/pub/developer/xmp/sdk/XMP-FileInfo-SDK-5.1.zip
    But invisibly, you can also access the CS4 SDK:
    http://download.macromedia.com/pub/developer/xmp/sdk/XMP-FileInfo-SDK-4.4.2.zip
    We will add the link to the SDK page soon.
    Hope this helps,
    -- Stefan

  • Write XMP data to custom FileInfo Panel in CS5

    Hello,
    I have created a custom FileInfo Panel in CS5.5. We had a programmer create a shell script to do the same thing for CS3, but now he wants too much money to rewrite the script for CS5.5. I was able to create the custom info panel easily using a text editor (he claimed you needed FlashBuilder which he wanted us to pay for). It works perfectly and even maps to Xinet with no problem. But his shell script and Applescript (from Filemaker to file) no longer work. The data is being embedded into the file, but not using the new custom info panel. Is there anyone out there that knows how to either write to a custom info panel or could help me figure it out...or even tell me how to map the data to the correct info panel? I'm no programmer, but I can hack my way through a lot of stuff.
    If someone wants a paying gig to make this happen, please respond.
    Thanks!
    -Motogrrl1313

    I already have a filemaker applescript that copies the data to a web page in Xinet. Not knowing too much about bridge, I'd have to see how Bridge reads the panel and figure out how to map the copy to Bridge. Has anyone ever done that? This was going to be my alternate solution when I was looking to do this in CS3, then I found the guy who had written the app to write to the file. This would make a good compromise, though.

  • Referencing Bridge folder from an Illustrator script... How?

    I need to access a file in the Bridge directory, from a script in Illustrator. I can do this for PC with a concrete reference like this:
    var loc = "C:/Program Files/Adobe/Adobe Bridge CS3/webaccesslib.dll"
    How do you construct a string to get at it on a Mac?
    thanks,
    -J

    Go to the scripting Forums and select the Illustrator Script forum and ask there.

  • Convert Illustrator script from cs3 to CS5

    Hi Everyone,
    I'm new to illustrator scripting I did some simple InDesign script before but this the first time I am ask to create script for Illustrator.
    We have an old script that will create a report for the properties (e.i.: fonts, linkedImages, strokeWeights, dashes, strokeColors, etc.) of illustrator file. The script is working in CS2 and CS3 but since most of production people are now using CS5 and CS6 they ask if we could migrate this script to CS5. The script is using hashtable.jsx to get those properties. Does the CS5 script still need hashstable file or I have to create the script from scratch with out using the hashtable script?
    Any suggestion or information on how I could convert the script to higher version is mostly appreciated.
    Thanks and regards,
    --elmer

    I can't see #include in the script the only thing hashtable is called by this function. According to what I've read about the hashtable.jsx since it is in the startup script folder illustrator will autoload this script upon launching of the application.
    function TechArtProperties(parent) {
      this.width = 0;
      this.height = 0;
      this.colorMode = DocumentColorSpace;
      this.fonts = new Hashtable();
      this.embeddedImages = new Hashtable();
      this.linkedImages = new Hashtable();
      this.lockedObjects = 0;
      this.hiddenObjects = 0;
      this.strokeWeights = new Hashtable();
      this.dashes = new Hashtable();
      this.strokeColors = new Hashtable();
      this.fillColors = new Hashtable();
      this.effects = new Hashtable();
      this.brushes = new Hashtable();
      this.transparencies = new Hashtable();
      this.gradients = new Hashtable();
      this.layers = new Hashtable();
      this.parent = parent;
      this.total =0;
      this.artName = "";

  • Indesign from Illustrator Script

    I'd like to automatically open InDesign/InDesign script from an Illustrator script.
    There would be some arrays with data that will be passed on to the InDesign script for processing.
    I thought that involved #target indesign but that does not seem like what I need to do.
    I may just export the values to a txt from Illustrator if there are a lot of bugs in this process and then run the other script manually from InDesign.
    Javascript
    CS6

    Then it seems like I'd like to go the export txt route.
    That doesn't seem to be an option through scripting though you can manually do it??
    myCSVFileName = "illustratorValues.csv";
    myCSVFilePath = "~/desktop/"+ myCSVFileName;
    myCSVFile = new File(myCSVFilePath);
    myCSVFormat = ExportFormat.textType;
    myDoc= app.activeDoc;
    myDoc.exportFile(myCSVFile, myCSVFormat);
    ExportType.JPEG
    ExportType.PHOTOSHOP
    ExportType.SVG
    ExportType.PNG8
    ExportType.PNG24
    ExportType.GIF
    ExportType.FLASH
    ExportType.AUTOCAD
    ExportType.TIFF
    txt isn't an option like in indesign?

  • How to outline text in illustrator scripting

    I want to create storke in text in illustrator scripting and found one method too createoutline(),But How i used this method for text outline.

    var docRef = app.activeDocument;
    var colorForText = new CMYKColor();
        colorForText.black = 0;
        colorForText.cyan = 0;
        colorForText.magenta = 0;
        colorForText.yellow = 0;
    var colorForTextOutline = new CMYKColor();
    colorForTextOutline.black = 100;
    colorForTextOutline.cyan = 0;
    colorForTextOutline.magenta = 0;
    colorForTextOutline.yellow = 0;
    var outlineSize = 5;
    for (i = docRef.textFrames.length-1; i >=0; i--) {
        for (j = 0; j < docRef.textFrames[i].words.length; j++){
            docRef.textFrames[i].words[j].filled = true;
            docRef.textFrames[i].words[j].fillColor = colorForText;
    var outline = docRef.textFrames[i].duplicate(docRef, ElementPlacement.PLACEATEND);
        for (h = 0; h < outline.words.length; h++) {
            outline.words[h].filled = true;
            outline.words[h].fillColor = colorForTextOutline;
            outline.words[h].stroked = true;
            outline.words[h].strokeColor = colorForTextOutline;
            outline.words[h].strokeWeight = outlineSize;
    //docRef.textFrames[i].createOutline();
    //outline.createOutline();
    createOutline(); converts live text to outlines, if you are trying to just create a stroke you have to go about it a different way. This script will take the text and copy it, put it in back, and put a stroke behind on the behind text so it has an effect similar to an offset path. The way I have it leaves the text live, if you were wanting to convert the text to outlines as well I left that part written in the bottom of the script. There is also a StrokeJoin parameter as well.
    Hope this helps!

  • Looking for professionals with Illustrator scripting experience near Nürnberg Germany

    I work for a large consumer products company with a large in-house design team working on Illustrator as a main platform. I'm looking for advice on where to find individuals with a lot of Illustrator scripting experience to help our team for a limited time duration. Any thoughts on other forums, job posting sites etc. where I could search for this would be greatly appreciated. Our company is located near the Nürnberg metro area in Germany and ideally are looking for on-site help. Thanks!

    I know at times it doesn't look like it but I do have a day job ( just about ) Carlos… Language would a problem too ( I just about do english as we brits do, pig ignorant bunch ) I've been to Hamburg and the beer was great thou…
    I don't know why but I have think Chris Gebab may be from that way…

  • Illustrator Scripting

    Preferably this will be done with a JavaScript so it will be cross-platform.
    I need a script that will take objects on the artboard, give them a unique name (perhaps Object01 to Object99) for exampe and export each as a SWF file or a high-resolution PNG with bounding boxes defined by the object, not the artboard.
    Is this possible?  I am waiting for a book for Illustrator Scripting to come in the mail but I thought I would post this here.
    My intention is to use the resultant exports in an ActionScript file and reference them from an assets folder where they will be placed.  I hope to maintain the placement of the exports according to their position on the artboard but I want them to have unique bounding boxes.  If I were working in Flash alone the placement of the objects on the stage would be maintained but I would still need a script to name each Movie Clip Object and export the library to an assets folder.
    Is this possible?  I have posted in the ActionScript forum as well but I just thought I might be able to bypass Flash and use Illustrator to generate the Movie Clips with names.

    It merely takes a few steps to do it using some standard commands:
    - Put the desired objects onto one main layer
    - Highlight that layer in the Layers palette
    - Choose the Release to Layers command (sequence) in the Layers palette menu
    - Export to .swf and choose the Export Layers to SWF files option in the SWF Export dialog

  • Portal 7.0 Hide Links on Panel

    Hello experts,
    I'd like to know how I can hide the links on Panel of Portal 7.0
    I know the propriety of iView for close the Panel:
    Initial State of Navigation Panel == CLOSE
    But in my case I just want to hide the links.
    Take a look the image bellow for you understand this better:
    http://img833.imageshack.us/img833/6686/helpportal.jpg
    Cheers,
    []´

    Firstly, Thanks everyone for the attention !!
    I tried to do this.. but this did not work!!
    When I set the property Invisible in Navigation Areas on the iView, then whole page goes empty !!
    The iView is like than:
    [http://img231.imageshack.us/img231/7168/helpportal10.png]
    I'd like to do something like this:
    [http://img709.imageshack.us/img709/5694/helpportal11.jpg]
    Edited by: Tulio Vargas on Aug 16, 2010 4:53 PM
    Edited by: Tulio Vargas on Aug 16, 2010 4:55 PM

  • Illustrator scripter needed

    Illustrator scripter needed to write a simple script regarding layers in AI.
    If you are interested, please contact me at [email protected]

    hi all,
    this is my first time to this forum , I need your help friends .I want to apply background color to pageitem using javascriping
    (widows os). How can I do this?
    Please send the mail regarding to this to [email protected] or [email protected]
    Thanks in advance
    Dhananjay Patil

  • Could anyone write an Illustrator script for me? will pay

    Hi,
    I am looking for a illustrator script to help my work. I have lots of pictures placed in illustrator, and a drew line with a custom size. The size of the pictures can not be changed, and what I want to do is the script can auto select pictures and line them up (with a custom space between the pictures), so the length of the pictures can be equal to the line's length. After the script finished with one group of pictures, it will turn to line up another group automatically.
    How long it gonna take for you to write a script like that and how much is it?
    Thanks
    Michelle

    align and distribute can't do that?
    Adobe Illustrator * Moving, aligning, and distributing objects

Maybe you are looking for