7 Replies Latest reply on Oct 27, 2009 9:18 AM by Techi Panda

    Execute photoshop from indesign

    Techi Panda Level 2

      Hi scripters

       

      I have selection in my indesign document

       

      var myFigure = app.selection[0];

      app.copy();

       

      I have copied my selection image, now I want to open the photoshop and paste into new document

       

      this can be possible from indesign cs3 javascript?

       

      thanks in advance

       

      regards

      a r u l

        • 1. Re: Execute photoshop from indesign
          Muppet Mark-QAl63s Level 4

          Using JavaScript I think you would need to do this by using a Bridge Talk message

          1 person found this helpful
          • 2. Re: Execute photoshop from indesign
            S.Biancardo Level 1

            BridgeTalk.launch('PhotoShop');

            • 3. Re: Execute photoshop from indesign
              Muppet Mark-QAl63s Level 4

              I don't know what kind of milage you will get from this Im still pretty new to JavaScript & ID.

               

              #target indesign

               

              var myFigure = app.selection[0];

              app.copy();

              pasteToPhotoshop();

               

              function pasteToPhotoshop() {

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

                   var bt = new BridgeTalk();

                   bt.target = "photoshop";    

                   // Make your new doc large enough to take your copied item

                   bt.body = "var docRef = documents.add(500, 1500, 300, 'ID copy', NewDocumentMode.CMYK, DocumentFill.TRANSPARENT);" + "\r"

                   + "PasteSmartObject();" + "\r"

                   + "docRef.trim(TrimType.TRANSPARENT, true, true, true, true);" + "\r"

                   + "function PasteSmartObject() {" + "\r"

                   + "function cTID(s) { return app.charIDToTypeID(s); };" + "\r"

                   + "function sTID(s) { return app.stringIDToTypeID(s); };" + "\r"

                   + "var desc1 = new ActionDescriptor();" + "\r"

                   + "desc1.putBoolean( cTID('AntA'), false );" + "\r"

                   + "desc1.putClass( cTID('As  '), sTID('smartObject') );" + "\r"

                   + "desc1.putEnumerated( cTID('FTcs'), cTID('QCSt'), cTID('Qcsa') );" + "\r"

                   + "var desc2 = new ActionDescriptor();" + "\r"

                   + "desc2.putUnitDouble( cTID('Hrzn'), cTID('#Pxl'), 0.000000 );" + "\r"

                   + "desc2.putUnitDouble( cTID('Vrtc'), cTID('#Pxl'), 0.000000 );" + "\r"

                   + "desc1.putObject( cTID('Ofst'), cTID('Ofst'), desc2 );" + "\r"

                   + "executeAction( cTID('past'), desc1, DialogModes.NO );" + "\r"

                   + "};";

                   bt.send();

              }

              }

              1 person found this helpful
              • 4. Re: Execute photoshop from indesign
                Techi Panda Level 2

                Hi Muppet Mark

                 

                thanks a lot for your work, actually my goal is I want to fit picture frame exactly into my EPS file placed in Indesign. My EPS file is created from MathType, while I am creating Math equations using MathType the EPS file results 4pts white space around the image. Now I planed to duplicate the selected EPS file to Photoshop and send the "CROP" option it will remove 4pts white space around the image in the Photoshop, from Photoshop I will get the exact height and width values, then I will fit in Indesign.

                 

                This is what I am trying do u have any other way to remove white space around the EPS file created from MathType.

                 

                thanks in advance

                 

                regards

                a r u l

                • 5. Re: Execute photoshop from indesign
                  Muppet Mark-QAl63s Level 4

                  You are going about this a different way as I think I would but this should be what you want…

                   

                  Replace 'TrimType.TRANSPARENT' with 'TrimType.TOPLEFT '

                   

                  This will trim away surrounding area that is the same colour value as your top left pixel (white)

                  • 6. Re: Execute photoshop from indesign
                    Kasyan Servetsky Level 5

                    Why do you want to rasterise vector EPS files in PS?!

                    I offer just to change geometric bounds of a graphics object and the frame that contains it. If I understand you correctly, you want to trim off every edge of the image by 4 points.

                    Here is what I would do (this is very basic, I assume that a frame containing an image is selected and measurements are set to points):

                     

                    // the amount you want to trim off

                    shift = 4;

                    sel = app.selection[0];

                    gr = app.selection[0].graphics[0];

                    gr_gb = gr.geometricBounds;

                    gr_gb[0] -= shift;

                    gr_gb[1] -= shift;

                    gr_gb[2] -= shift;

                    gr_gb[3] -= shift;

                    gr.geometricBounds = gr_gb;

                    fr_gb = sel.geometricBounds;

                    fr_gb[2] -= shift*2;

                    fr_gb[3] -= shift*2;

                    sel.geometricBounds = fr_gb;

                    • 7. Re: Execute photoshop from indesign
                      Techi Panda Level 2

                      HI Muppet Mark and Kasyan Servetsky

                       

                      thanks a lot for your messages, your ideas helps

                       

                      hi Kasyan Servetsky my problem is the 4pt white space is not fixed for all the images some images have 2pt white space to trim and some have 5pt white space

                       

                      do you have any ideas to trim vector images in indesign

                       

                      thanks in advance