10 Replies Latest reply on Nov 16, 2009 5:04 PM by romanobstuder

    Update Links in Illustrator

    pvisell

      Hello,

       

      I am new to Indesign and Illustrator.  I have a document from the business that has all it's data derived from XML and images are linked.  The document also has graphs.  Again the data for the graphs is from xml.    Currently, this process is completely manual and obviously time consuming.  We thought that the entire process could be automated in Indesign.  We can output all the xml in the correct format and always put it in the same network location.

       

      I have created a template in Indesign which has links to xml to feed it's tables.  I also have a graph placed on the document that I created in Illustrator.  Within Illustrator the data is obtained from an xml file.  Basically, I would like to just open the Indesign Template and all the links to update including the data on the graph.

       

      Currently, when I open the Indesign template it asks if I would like to update the links within the Indesign document.  Therefore, all images and the data in the tables is updated.  But of course the data in the graph remains the same.  I was wondering if there is a way, eg script, which will open Illustrator, load the variables and update the dataset.  Then save the graph and close it.  Then I would like to automatically update the link within the indesign document to refresh the graph.

       

      Please could you also include any code that would help me out.  Thanks in advance.

        • 1. Re: Update Links in Illustrator
          [Jongware] Most Valuable Participant

          InDesign itself doesn't talk to Illustrator, but you could take a look at BridgeTalk, which is designed to operate on both InDesign and Illustrator.

          1 person found this helpful
          • 2. Re: Update Links in Illustrator
            AdobeScripts Level 3

            hi

             

            if you work on PC - you can use VisualBasic to control both applications at the same time

             

            robin

             

            www.adobescripts.co.uk

            • 3. Re: Update Links in Illustrator
              pvisell Level 1

              Hi,

               

              Thanks for you help.  I was planning to do this in Javascript however I could use Visual Basic.  Any chance you have some code that I could use to start with?  Just need something to start with and open up the different applications.  Thanks.

              • 4. Re: Update Links in Illustrator
                AdobeScripts Level 3

                Thanks for you help.  I was planning to do this in Javascript however I could use Visual Basic.  Any chance you have some code that I could use to start with?  Just need something to start with and open up the different applications.

                 

                to connect to CS4 apps:

                 

                Set myIlustr = CreateObject("Illustrator.Application.14")

                Set myIlustrDoc = myIlustr.ActiveDocument


                Set myInDi = CreateObject("InDesign.Application.CS4")

                Set myInDiDoc = myInDi.ActiveDocument

                 

                but I don't know how to modify charts in Illustrator - no need to do this before

                 

                robin

                 

                www.adobescripts.co.uk

                • 5. Re: Update Links in Illustrator
                  pvisell Level 1

                  Thanks very much Robin. Let me give that a shot and see if I get anywhere.

                   

                  If anyone else has some more code please post.  Thanks.

                  • 6. Re: Update Links in Illustrator
                    Muppet Mark-QAl63s Level 4

                    Here is a very crude example of sending a message to Illustrator from Indesign. For this I decided to use the 'edit original' from the links collection to open the linked file for me then from here send a Bridge Talk message (delete the graph in this test case) save the file on closing thus updating its status in ID then loop through updating. In my very basic test file this worked fine. There are better ways than my delay method of talking back & forth with Bridge Talk but Im new and thats way over my head for now. Should be enough to get you started though…

                     

                     

                    #target indesign

                     

                    function main() {

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

                    alert("Please have an 'Indesign' document before running this script.");

                    return;

                    }

                    var docRef = app.documents[0];

                    // Loop through the links

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

                    docRef.links[i].editOriginal();

                    $.sleep( 3000 ); // Just my novice delay method

                    updateGraph();

                    $.sleep( 3000 ); // Ditto here

                    }

                    updateLinks(docRef);

                    };

                    // Reverse loop to do this

                    function updateLinks(docRef) {

                    for (var i = docRef.links.length-1; i >= 0; i--) {

                    if (docRef.links[i].status == LinkStatus.linkOutOfDate) {

                    docRef.links[i].update();

                    }

                    }

                    }

                    // A basic Bride Talk example

                    function updateGraph() {

                    if ( BridgeTalk.isRunning( "bridge" ) ) {

                    var bt = new BridgeTalk();

                    bt.target = "illustrator";

                    bt.body = "alert('Updating Graph Data');" + "\r"

                    + "var docRef = app.activeDocument;" + "\r"

                    // Put your update stuff here

                    + "docRef.graphItems.removeAll();" + "\r"

                    // Save to modify the link status

                    + "docRef.close(SaveOptions.SAVECHANGES);";

                    bt.send();

                    }

                    }

                     

                    main();

                     

                    Message was edited by: Muppet Mark Corrected typo

                    • 7. Re: Update Links in Illustrator
                      pvisell Level 1

                      Cheers Mark,

                       

                      The code makes sense and I'll try it to see if Bridge will sort out the comms between ID and AI.

                      • 8. Re: Update Links in Illustrator
                        pvisell Level 1

                        Hi Mark,

                         

                        Your code worked brilliantly.  Thanks very much to everyone for your help.  Just one last problem to do with having to run the code in Illustrator twice.  If any one has any ideas to what the issue is on my post of "Dataset not updating automatically" under Illustrator Scripting, it would be appreciated.  Thanks again.

                        • 9. Re: Update Links in Illustrator
                          Muppet Mark-QAl63s Level 4

                          Im Glad it worked for you. I did take a quick look at the problem with data sets in illustrator but did not have the time to do any testing. (big catalogue with a press deadline today pdfing like crazy)

                           

                          data sets do have an update(); method I thought you may have missed out I may get back to this…

                          • 10. Edit graphitem in Illustrator via script
                            romanobstuder Level 1

                            Hi Muppet Mark

                            You sound like you got some experience with scripting in ID and ILL.

                            I find it is very difficult to find any help in this area. The documentation by Adobe on ILL scripting are next to useless.

                             

                            I have scripted a combination of ID and Ill scripting.

                             

                            An ID document contains tables with data in the table. The tables contain some special parameter informations, using a specific Style.

                            If I find such a table I extract data and send this plus a complete script over to Illustrator. Illustrator then opens a defined Template with a graph and runs the data over the graph. It saves a graph at a defined place on the server. We then jump back to the ID file. I then import the created Graph in an image frame on top of the table.

                            So we got an auto table to graph function working.

                            So far so good. Now it turns out that the data from our client needs to be graphed not just from values 0 to the max of the data, but a given range for example Min 480 Max 580 Divisions 9. This can be manually changed: Graph Type / Tick Values / Override Calculated Values.

                             

                            I can feed these parameters from ID and send it over to ILL but have so far not found any handle on programatically changing the override values.

                             

                            I start thinking this is not possible at all. But there is always hope...

                             

                            If anybody has an idea on how to tackle this I would be a very happy man. (for a few minutes anyway)  -)

                             

                            Happy Scripting

                            Romano