Using PhotoShop Action/Scripts in command line

Community Beginner ,
Apr 07, 2014 Apr 07, 2014

Copy link to clipboard

Copied

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.

TOPICS
Actions and scripting

Views

23.9K

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Apr 08, 2014 Apr 08, 2014

Copy link to clipboard

Copied

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/

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 10, 2014 Apr 10, 2014

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Apr 10, 2014 Apr 10, 2014

Copy link to clipboard

Copied

LATEST

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)

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines