6 Replies Latest reply on Apr 7, 2013 5:32 PM by Trevorׅ

    Calling scripts between applications

    KuddRoww

      Yesterday I wrote a similar question but after reviewing it was clear I didn't ask the question very well.

       

      If I'm doing some projects with InDesign files that involve utilizing other products within the Adobe Creative Suite, such as Illustartor to maniuplate images, is it possible for me to create a single script which can handle the call to scripts which are executed by different applications?

       

      For example:

       

      1) Execute main script, or function.

      2) Target an application and do stuff, collect information for next step.

      3) Target another application and do stuff with information collected in previous step.

       

      main(); function targetThis(){     #target InDesign do stuff...     alert(app.name);//test for target     } function targetThat(){     #target Illustrator do stuff...     alert(app.name);//test for target     } function main(){ targetThis(); // I would expect Adobe InDesign... I get Adobe Illustrator targetThat(); // I would expect Adobe Illustrator... I get Adobe Illustrator }

       

      So is there a way for me to call scripts to do work in different applications from a single point? Otherwise I'm simply going to output the results to a text file and process them in illustrator that way. I just strongly feel that there has to be a way to be able to call scripts for execution in a variety of Adobe applications for a single point. Clearly you can only "target" once, the #target doesn't belong to the method or else it would execute in the order its called, but it targets based on the first target processed by the engine.

       

      The reason for the question is that I'm trying to create an EPUB3 file that doesn't make a bitmap export of the images. The images look like crap when exported to tablet because of the bitmap conversion. So I'd prefer to export the files as vectors, so I go through the InDesign document and create all of the structure and content files, then I want to go into illustrator and convert all of the proprietary vectored images (AI) into more widely support vector images (SVG). For me its PITA enough that I have to run two scripts to get the files zipped properly, having to hack something together to get Illustrator and InDesign to synchronize their efforts is just another straw on a very tired camel.

        • 1. Re: Calling scripts between applications
          Trevorׅ Adobe Community Professional

          Hi Kudrow,

           

          One solution can be found here (I think) http://forums.adobe.com/message/4179949#4179949

          I asked the question sometime back.

           

          In your case it might be better to use bridgetalk but I can't help with that.

           

          Trevor

           

          Edit by me - [ myEdit in js [:-) ]

          Clearly you can only "target" once, the #target doesn't belong to the method or else it would execute in the order its called, but it targets based on the first target processed by the engine.

          The above link show's that you can target more than once

          • 2. Re: Calling scripts between applications
            Trevorׅ Adobe Community Professional

            Just a couple of important warnings about using Marc's trick.

             

            1) You can't have line annotations like this

            var doc = app.documents.add() // creates a new documents - this comment will mess up the script
            

            but you can have this time of annotation

            var doc = app.documents.add() /* creates a new documents - this comment is fine */
            

             

            2) You can't leave out ANY semicolons.

             

            I found the the method very useful for dealing with session memory issues

            • 3. Re: Calling scripts between applications
              Kasyan Servetsky Level 5

              As Trevor already mentioned, you can achieve this by using BridgeTalk (btw it has nothing to do with Bridge application).

              Here is an example -- a script and sample files -- of interacting InDesign with Illustrator.

               

              If you're on Mac, you can achieve this more easily, like so:

              tell application "Adobe InDesign CS6"

                  --  do this

              end tell

               

              tell application "Adobe Illustrator CS6"

                  --  do that

              end tell

              • 4. Re: Calling scripts between applications
                Trevorׅ Adobe Community Professional

                Hi Kasyan

                 

                #5 on that post was a nice one, I wonder if Kudrow will have a similar response when he gets back to his computer.

                 

                1)     Regarding the sample files there, should they go in a specific location, be open etc.? (Sorry for being a bit too much on the lazy side and not trying to figure it out from the script.

                 

                2)     Does one have to be careful with functions called to source with the 2 points mentions in point 2 above.

                 

                Trevor

                • 5. Re: Calling scripts between applications
                  Kasyan Servetsky Level 5

                  Hi Trevor,

                   

                  1)     Regarding the sample files there, should they go in a specific location, be open etc.? (Sorry for being a bit too much on the lazy side and not trying to figure it out from the script.

                  The sample files can be anywhere, only the xml-file is harcoded (of course, "choose a file" dialog can be used instead). But the only purpose of the script was to demonstrate how to use BridgeTalk to communicate between InDesign and Illustrator.

                   

                  2)  Does one have to be careful with functions called to source with the 2 points mentions in point 2 above.

                  Once I wrote a complex script (InDesign + Photoshop + Mail app) and remember that it failed to work with comments in BridgeTalk's body message. Since then I never use them there.

                  I always place semicolons at the end of lines (but must admit very rarely I unintentionally forget to do this ) so I have no idea if it would work without them.

                   

                  Regards,
                  Kasyan

                  • 6. Re: Calling scripts between applications
                    Trevorׅ Adobe Community Professional

                    Thanks for the feedback