2 Replies Latest reply on Jun 4, 2012 2:14 AM by goldbridge

    use BridgeTalk,but my script doesn't work

    goldbridge

      Hi,

      I want to use BridgeTalk to open a image in photoshop,but my script doesn't work.

      Anyone can tell me why?Thanks!

       

      Best Regards

      goldbridge

       

       


      #target indesign

      #targetengine "MyEngine"

      var doc=app.activeDocument;

      if(doc.selection.length>0)

                {

                          if(doc.selection[0].constructor.name=="Image")

                           {

                                 jpgpath=new File(app.selection[0].itemLink.filePath);

                                 bt = new BridgeTalk;

                                 bt.target = "photoshop";

                                 bt.type = "iterator";

                                 bt.body="{app.open(jpgpath);}";

                                 bt.onResult = function(resObj) {};

                                 bt.send();

                                 BridgeTalk.bringToFront("photoshop");

                            }

                }

       

        • 1. Re: use BridgeTalk,but my script doesn't work
          Muppet Mark Level 5

          In your body script… jpgpath is just part of a string you have not constructed this to pass the variable… Also some classes are considered complex types so you need to toSource() and then eval…

           

          #target indesign
          #targetengine "MyEngine"
          var doc=app.activeDocument;
          if(doc.selection.length>0)
                    {
                              if(doc.selection[0].constructor.name=="Image")
                               {
                                     jpgpath=new File(app.selection[0].itemLink.filePath).toSource();
                                     bt = new BridgeTalk;
                                     bt.target = "photoshop";
                                     bt.type = "iterator";
                                     bt.body = "{app.open( eval (" + jpgpath + ") );}";
                                     //$.write( bt.body  );
                                     bt.onResult = function(resObj) {};
                                     bt.send();
                                     BridgeTalk.bringToFront("photoshop");
                                }
                    }