Skip to main content
Known Participant
April 21, 2010
Question

Place smart object into pre-existing Photoshop file

  • April 21, 2010
  • 1 reply
  • 7746 views

There's not a way to do this in Bridge, but maybe there is a way to script it?

I've never used a Bridge Script but would love to how to implement them, if I can get a script to do this...

I need to Import multiple files into an existing photoshop file (with a predetermined size ) as smart object layers in photoshop.

The options that Bridge currently offers falls short in 2 area

  • Load Files into Photoshop Layers-- does not import smart objects and creates a new photoshop file that ends up being as large as the largest imported file
  • Place into Photoshop--only lets you do one at a time

I need "Place into Photoshop" with multiple files

Is there a way to do this?

Thanks!!

This topic has been closed for replies.

1 reply

Paul Riggott
Inspiring
April 24, 2010
k_loyAuthor
Known Participant
April 24, 2010

I did see, thought how do I implement it?

Do I put it in the photoshop scripts folder? Does it have to be a certain kind of file?

June 1, 2011

Please try this version, I've tested this in CS4...

#target bridge
if( BridgeTalk.appName == "bridge" ) {
  PlaceFiles = new MenuElement("command", "Place Files In Photoshop",
                               "at the end of Thumbnail");
  PlaceFiles.onSelect = function () {
    placeFilesInPhotoshop();
  };

  function placeFilesInPhotoshop(){
    var sels = app.document.selections;
    for (i = 0; i < sels.length; i++) {
  var t = new Thumbnail(sels);
      sendPicToPhotoshop(sels.path);
    }
  };
  function sendPicToPhotoshop(fileName) {
    function _placeFile(fileName) {
      if (!app.documents.length)  return;    
      var id35 = charIDToTypeID( 'Plc ' ) ;
      var desc8 = new ActionDescriptor();
      var id36 = charIDToTypeID( 'null' );
      desc8.putPath( id36, new File(fileName));
      var id37 = charIDToTypeID( 'FTcs' );
      var id38 = charIDToTypeID( 'QCSt' );
      var id39 = charIDToTypeID( 'Qcsa' );
      desc8.putEnumerated( id37, id38, id39 );
      var id40 = charIDToTypeID( 'Ofst' );
      var desc9 = new ActionDescriptor();
      var id41 = charIDToTypeID( 'Hrzn' );
      var id42 = charIDToTypeID( '#Pxl' );
      desc9.putUnitDouble( id41, id42, 0.000000 );
      var id43 = charIDToTypeID( 'Vrtc' );
      var id44 = charIDToTypeID( '#Pxl' );
      desc9.putUnitDouble( id43, id44, 0.000000 );
      var id45 = charIDToTypeID( 'Ofst' );
      desc8.putObject( id40, id45, desc9 );
      executeAction( id35, desc8, DialogModes.NO );
    };
    var bt = new BridgeTalk;
    bt.target = "photoshop";
    var myScript = ("var _ftn = " + _placeFile.toSource() + "; _ftn(" +
                    fileName.toSource() +");");
    bt.body = myScript;
    bt.send();
  };
};


Paul, your script works beautifully!  I've implemented and tested it in CS3.  Thanks so much!