4 Replies Latest reply on Jul 2, 2015 8:53 AM by michelr31372089

    spreadsheet to text layer script?

    dcsimages

      Does anyone know of a script that will create a new photoshop file, copy a row of text from a spreadsheet, csv or delimited text from another doc, paste into a text layer, save and close, go to the next row of text and repeat until the end?

        • 1. Re: spreadsheet to text layer script?
          Chuck Uebele Adobe Community Professional & MVP

          It can be made, but I don't know of any existing scripts. Most scripts are custom for the user, which is what you want. So finding a preexisting script will be difficult if not impossible.

          • 2. Re: spreadsheet to text layer script?
            michelr31372089 Level 2

            Excuse my poor English. You create in the folder where your script is a text file in which there are 4 lines. For instance :

            Line 1

            Line 2

            Line 3

            Line 4

             

            The following script reads each line, creates a new doc, add a text layer above the background, writes inside the content of the line and saves the document (psd format) in the folder where the script is.

            // MAC Finder ou WINDOWS Explorer

            #target photoshop

            app.bringToFront();

             

            main();

             

             

            function main()

            {

                var currentPath = (new File($.fileName)).path+"/";

                var fileTextName = currentPath+"lines.txt";

                var read_file = File(fileTextName);

                var line = "";

                var artLayerRef="";

                var psd_Options="";

                var newFile="";

             

                // Opens the text file lines.txt that exists in the script folder

                read_file.open('r');

                while(!read_file.eof)

                {

                    line=read_file.readln();

                    // Creates a new Photoshop document

                    app.documents.add();

                    newFile = app.activeDocument;

                    // Creates a new text art layer

                    artLayerRef = newFile.artLayers.add();

                    artLayerRef.kind = LayerKind.TEXT;

                    artLayerRef.textItem.contents = line;

                    // Saves PSD options

                    psd_Options  = new PhotoshopSaveOptions(); // [PhotoshopSaveOptions]

                    psd_Options.layers  = true; // preserves layers

                    psd_Options.embedColorProfile = true; // preserves profile

                    psd_Options.annotations = true; // preserves notes

                    psd_Options.alphaChannels = true; // preserves alpha channels

                    psd_Options.spotColors = true; // preserves inks

                    // Save the new document

                    newFile.saveAs( File(currentPath + '/' + line + ".psd" ), psd_Options, true );

                    newFile.close(SaveOptions.DONOTSAVECHANGES);

                }

                read_file.close();  

            }

            • 3. Re: spreadsheet to text layer script?
              dcsimages Level 1

              Thanks Michael

               

              Works perfectly.

               

              It's such an uncomplicated script that I wonder why something similar isn't already included with the other preset scripts.

              • 4. Re: spreadsheet to text layer script?
                michelr31372089 Level 2

                Hope it will help. Best regards.