3 Replies Latest reply on Apr 10, 2014 12:12 PM by Tom Ruark

    Using PhotoShop Action/Scripts in command line

    RobertMAG Level 1

      Hello everyone,

       

      I am working on a project that needs to run PhotoShop's script/action on a folder everyday. It needs to be done automatically without no user interaction.  Ideally, I would create a Window Service, because besides running PhotoShop, it needs to run other routines (record the action, enter data in tables, etc).

       

      Does anyone know if PhotoShop can be ran like Command Line like?

       

      Thanks

       

      Robert J.

        • 1. Re: Using PhotoShop Action/Scripts in command line
          c.pfaffenbichler Level 9

          As far as I can tell Photoshop is not intended to and can’t be run as command-line.

           

          But if I understand correctly it is possible to create a hotfolder setup, if this would help you may want to do Forum searches here and over at

          http://ps-scripts.com/bb/

          • 2. Re: Using PhotoShop Action/Scripts in command line
            RobertMAG Level 1

            Thanks for the replay, unfortunately, Photoshop doesn't have a command line capabilities, but I was able to automate and call an Action.  I created a VB.NET window application, added the reference to "Adobe PhotoShop CC Object Library".  I added this code to a button's Click Event

             

                Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

                    Dim appRef As Photoshop.Application = CreateObject("Photoshop.Application")

                    Dim sFile As String = "C:\Temp\Images\MyPicture.psd"

             

                    appRef.Open(sFile)

                    appRef.DoAction("ResizeToJPG", "SavedActions")

                    appRef.ActiveDocument.Close()

                    appRef.Quit()

             

                    appRef = Nothing

                End Sub

             

             

            This will open up the PhotoShop Application.  I open the image, apply the Action, close the image, and shutdown the application.  Literally, you will see all the step on the computer, so make sure that you don't interfere with the steps.  Good Luck

             

            Robert J

            1 person found this helpful
            • 3. Re: Using PhotoShop Action/Scripts in command line
              Tom Ruark Adobe Employee

              Yes, it is doable. It is not easy.

              On windows you can open a command prompt and type 'cscript DocDuplicate.vbs'

              On the mac you can use 'osascript ...' I forget the actual params.

              No, you can't run Photoshop as a server or headless. It operates best if it is the only app running and the frontmost.

              And, you could get dialogs popping up that would halt your workflow. We try to get rid of these but there are still some that do not obey the NO dialog setting you can put in a script.

              There are tools available that can monitor for this situation. This is the hard part!

               

              Here is the content of DocDupliate.vbs

               

              Set app = CreateObject("Photoshop.Application")

                Set d = app.Documents.Add

                Set l1 = d.ArtLayers.Add

              Set l2 = d.ArtLayers.Add

                l2.Visible = false

                Set d2 = d.Duplicate

              Set d3 = d.Duplicate("foo")

              Set d4 = d.Duplicate("foo", true)