2 Replies Latest reply on Apr 10, 2016 5:36 AM by noha59530697

    A question about photoshop javascript


      Excuse me,is there have any javascript properties (or method) that can execute 'replace contents...' command of smart object ?

      thanks,my Email: 59634270@qq.com

        • 1. Re: A question about photoshop javascript
          JJMack Most Valuable Participant

          When you can not find something in Adobe DOM for what you want to do you need to resort to action manager code.  Adobe provides a plug-in Scriptlistener that will record action manager coder for what can be recorder in actions.  Like actions all options are hard coded.  However, you can replace the hard coded value recorded with a VAR. and create JavaScript functions from the Scriptlistener  recorded JavaScript code.


          If you install the scriptlistener plug-in ScriptListener.8li and replace the contents of a smart object layer you would see something like this recorded.


          // =======================================================

          var idplacedLayerReplaceContents = stringIDToTypeID( "placedLayerReplaceContents" );

              var desc14 = new ActionDescriptor();

              var idnull = charIDToTypeID( "null" );

              desc14.putPath( idnull, new File( "E:\\My Files\\Pictures\\Portrait\\LO2G5037.CR2" ) );  <------------------ replace the hard coded file with a variable

          executeAction( idplacedLayerReplaceContents, desc14, DialogModes.NO );

          • 2. Re: A question about photoshop javascript
            noha59530697 Level 1

            Thank you very much @Mr.JJMack, I will try to do that , Thank you for your help again !!