6 Replies Latest reply on Aug 24, 2016 8:30 AM by daneJ

    a script that communicates with AI and ID

    daneJ

      Hello Community

      I am currently trying to wrap my head around the Extendscript Toolkit. when i write a code i specify for program i want to use by selecting it in a drop down menu, However i want to use two different programs at the same time. I want to copy all the pageitems of a page in indesign and then paste it on a new page in illustrator. Does anyone know how i can have access to two programs at the same time?

      I wrote the follow bit which appears to give me the two application i want to use but the contents of these objects is not the same as if you write "app." with for example indesign selected as your target application.

       

      function main(){

          var inApp = this.indesign11;

          var illApp = this.illustrator;

      }

       

      if i write inApp.activeDocument the Toolkit just ignores it.

       

      If anyone has any suggestion i'd be happy to hear them.

       

      Thanks,

      Dane

        • 1. Re: a script that communicates with AI and ID
          Trevorׅ Adobe Community Professional

          Hi Dane

           

          You are using VBS in the ESTK which will not work.

          The ESTK only handles javascript.The javascript can run vbs by using app.doScript.

          The 'correct' way to communicate with ID and Ai is with BridgeTalk.

          There are examples of this in the scripting manual and on the forum.

           

          Good luck

           

          Trevor

          • 2. Re: a script that communicates with AI and ID
            G. Singelmann Level 3

            JavaScript is an interpreted language. Meaning: there must be a bit of software that runs it.

            With ExtendScript that is the Adobe Software itself.

             

            When you write a script for InDesign, Indesign itself is interpreting and running your code. When you write a script for Illustrator, Illustrator is interpreting and running your code.

             

            AppleScript is a different matter. AppleScript is run by the system and talks to applications and thus has no problem talking to several different applications in the same script.

             

            With ExtendScript things are more complicated. You can run a script in InDesign that collects a sort of script-package that it sends to Illustrator so that Illustrator can interpret and run it.

             

            When you are in ESTK, look in the help menu and you'll find the "JavaScript Tools Guide". This has a chapter on "Interapplication Communication with Scripts".

            This chapter explains the details.

            1 person found this helpful
            • 3. Re: a script that communicates with AI and ID
              Trevorׅ Adobe Community Professional

              Sorry there, you are clearly not using vbs!

              • 4. Re: a script that communicates with AI and ID
                G. Singelmann Level 3

                "Sorry there, you are clearly not using vbs!"

                 

                Since DaneJ was using the ESTK I thought he wasn't either.

                 

                :-p

                • 5. Re: a script that communicates with AI and ID
                  daneJ Level 1

                  Hello Trevor

                  Thanks for the help. BridgeTalk is the ticket. It does not help that I am trying to wrap my head around Javascript at the same time as figuring out bridgetalk.

                  After pounding my face against the computer for some hours i managed to produce this ridiculusly easy script which copies the contents of an indesign page and pastes it in AI.

                   

                   

                  #indesign

                   

                  function main() {

                      var inDoc = app.activeDocument;

                      var myPage = inDoc.pages.item(0);

                      var thisThing = myPage.pageItems.everyItem();

                      app.select(thisThing);

                      app.copy(thisThing);

                      Paste(thisThing)

                  };

                     

                      function Paste(thisThing) {

                          var bt = new BridgeTalk

                          bt.target = "illustrator";

                          bt.body =  "var illDoc = app.activeDocument;illDoc.artboards.add ([700,500,900,200]);var t = app.paste()";

                          bt.send();

                  };

                   

                  It is work in progress that will eventually copy each page in an ID document and pastes it in AI to a new artboard.

                   

                  Best Regards,

                  Dane

                  • 6. Re: a script that communicates with AI and ID
                    daneJ Level 1

                    Hello G. Singelmann,

                    Thanks alot for this tip. the "Interapplication Communication with Scripts" section was very helpful.

                    I am surprised there are no Youtube vids for any of this adobe scripting(with the exception of one from Creative Droplets).

                     

                    Best Regards,

                    Dane