7 Replies Latest reply on Feb 20, 2018 6:56 PM by Billg95222

    Script to Print to Multiple Printers

    Billg95222 Level 1

      I have a question about how to create an action or a script to print files in a folder to different printers.  I am using Photoshop 5 and Window 10.  I have several different printers.  For printing from Photoshop I use an Epson P800 for larger prints such as 16x20, for smaller prints such as 5x7 I use an Epson R3000.  I have folders set up, one for 5x7 and another for 16x20.  For example, I place 5 images in the 16x20 folder and 5 different images in the 5x7 folder.  I want to automatically, through an action, print all of the 16x20 images in the 16x20 folder to the Epson P800 printer.  I also want to print all of the images in the 5x7 folder to the R3000 printer.

       

      I created an action in Photoshop to do this.  One action for the P800 16x20 and another action for the R3000 5x7.  The problem is that the action sends the files to whatever printer is the CURRENT printer, meaning the one that I used last.  My work around for this is to open one of the files in the 16x20 folder and manually send it to the P800 printer, delete the file from the 16x20 folder, then run the P800 action as a batch on the remaining 4 images.  Then when I want to print to the R3000, I open one of the images in the 5x7 folder, manually send it to the R3000 printer, and then run the R3000 action as a batch on the remaining 4 images.  As you can see this is a real pain since I want this to be a fully automated process.

       

      I tried running Photoshop as administrator thinking that might make a difference but it didn't.  When I look at the text in the action it looks correct but I think it's because Windows has an operating system printer setting outside of Photoshop.  When I go to Settings - Printers in Windows the "Let Windows manage my default printer" is checked which sets the default printer to be the one you used most recently.  I think this is fine since otherwise I would have to always change the printer from the default (HP Officejet) to another anyway.  So how can I get the action to change the printer from the last one used to either the R3000 or P800?  Is there a script that can be run that would do this?  Is there some other way?

        • 1. Re: Script to Print to Multiple Printers
          Billg95222 Level 1

          I believe I may have found a way to do this using Powershell but I need to be able to call the Powershell script from the Photoshop script.  Does anyone know how to do this?  Or even the other way around, call a Photoshop script from a Powershell script? 

          • 2. Re: Script to Print to Multiple Printers
            r-bin Level 4

            Install the ScriptListener plugin temporarily.

            https://helpx.adobe.com/photoshop/kb/downloadable-plugins-and-content.html

             

            Launch photoshop.

             

            Open any file

            Call Menu-> File-> Print ...

            Select the first printer, configure printer settings and click "Done"

            Call Menu-> File-> Print ...

            Select the second printer, configure printer settings and click "Done"

            Post here the link to ScriptingListenerJS.log file.

             

            Close photoshop. Remove the ScriptListener plugin.

            • 3. Re: Script to Print to Multiple Printers
              Billg95222 Level 1

              I was able to figure out a solution.  I created an action for each printer/size combination in Photoshop.  I created a Photoshop script to iterate through the images in the size folders and calls the appropriate action.  And finally I created a PowerShell script for each size/printer combo that sets the default printer and calls the Photoshop script.  I put shortcuts on my desktop for each size/printer PowerShell script that I can right-click on and run with PowerShell. 

              • 4. Re: Script to Print to Multiple Printers
                Kukurykus Adobe Community Professional

                I had no chance to focus on attempt to do what you wished, but now when you say you figured out solution I'd like to see Photoshop and Powershell scripts you wrote. No enough life to learn everything myself. So if you would be so kind could you please share them with us? That may be useful for me in future and probably some other users from here. Thank You.

                • 5. Re: Script to Print to Multiple Printers
                  Billg95222 Level 1

                  Sure.  The following are examples for the 5x7 folder for the R3000 printer.  I made separate ones for each size and printer.  This is the Photoshop script that iterates through the 5x7 image folder and calls the action.

                   

                  #target photoshop

                  var sourceFolder

                  sourceFolder = new Folder("D:\\5x7");

                  var files

                  files = new Array();

                  files = sourceFolder.getFiles("*.jpg");

                   

                  if (files.length > 0)

                  {

                      for (i=0; i < files.length; i++)

                          {

                          var doc = app.open(files[i]);  // returns the document object

                          app.doAction("5x7 Print - R3000", "Print R3000");

                          doc.close(SaveOptions.DONOTSAVECHANGES);

                           }

                  }

                  else

                  {

                      alert('No files found.')

                  }

                   

                  This is the PowerShell script that sets the default printer to the R3000 and calls the above Photoshop script.

                   

                  $PrinterName="Epson Stylus Photo R3000(Network)"

                  $DefaultPrinter=Get-WmiObject Win32_Printer -Filter "Name='$PrinterName'"

                  $DefaultPrinter.SetDefaultPrinter()

                   

                  & "C:\Program Files\Adobe\Adobe Photoshop CS5 (64 Bit)\Photoshop.exe" -run "D:\My Files\Photoshop\Scripts\R3000 - Print 5x7.jsx"

                  1 person found this helpful
                  • 6. Re: Script to Print to Multiple Printers
                    r-bin Level 4

                    This will not work (you can check) if you are trying to print a file that was already printed on another printer and then saved. Also the "-run" key does not make sense for a photoshop. For him, the key is the file extension, in this case ".jsx".

                    Print the file to any printer, regardless of where it was previously printed using scripts that the ScriptListener plug-in gives and whose data I requested.

                     

                    P.S. I hope Google translate correctly )

                    • 7. Re: Script to Print to Multiple Printers
                      Billg95222 Level 1

                      The script I posted was in answer to my own question.  I can verify that yes it does work.  I have been using it now for several days without any issues.