2 Replies Latest reply on Jan 24, 2016 2:58 PM by dylman3000

    Scripting Linked Smart Objects

    dylman3000 Level 1

      Does anyone know of a way using any of the scripting languages available to Photoshop, preferably AppleScript, to convert an embedded smart object into a linked smart object?

        • 1. Re: Scripting Linked Smart Objects
          c.pfaffenbichler Level 9

          Use the Action Manager code as recorded by ScriptingListener.plugin.

          But you may want to use JavaScript if you are serious about automating Photoshop tasks with Scripting.

          • 2. Re: Scripting Linked Smart Objects
            dylman3000 Level 1

            Perfect! Thanks for the tip, you have opened a whole new world for me, I had no idea about the ScriptingListener.plugin. My final JavaScript code is for anyone else who stumbles across this thread:

             

            var filePath = "/Insert/Your/Path/To/Linked/File.psd"

             

            LinkedSmart( filePath )

             

            function LinkedSmart( filePath )

            {

            var idplacedLayerConvertToLinked = stringIDToTypeID( "placedLayerConvertToLinked" );

                var desc31 = new ActionDescriptor();

                var idnull = charIDToTypeID( "null" );

                    var ref12 = new ActionReference();

                    var idLyr = charIDToTypeID( "Lyr " );

                    var idOrdn = charIDToTypeID( "Ordn" );

                    var idTrgt = charIDToTypeID( "Trgt" );

                    ref12.putEnumerated( idLyr, idOrdn, idTrgt );

                desc31.putReference( idnull, ref12 );

                var idUsng = charIDToTypeID( "Usng" );

                desc31.putPath( idUsng, new File( filePath ) );

            executeAction( idplacedLayerConvertToLinked, desc31, DialogModes.NO );

            }

             

            Unfortunately my JavaScripting skills are quite weak compared to my AppleScript skills so I will be using AppleScript to launch the above JavaScript snippet.

             

            Thanks heaps for your help c.pfaffenbichler