Copy link to clipboard
Copied
So I discovers this really nifty api that allows you to control photoshop with python using win32com. (More info: photoshop-scripting-python!)
What i want my code to do is run a diffrent action on a JPEG depending on the name of the file it's located in. That part will be relativly easy to code out. The problem i run into is whne trying to run the action via python photoshop gives me the following error "The command 'play' is not currently available"
By doing some googling i've found that this error is displayed when some step in the action isn't behaving as it should. This could be due to a multitude of problems listed here: "The command “Play” is not currently available." - an action within an action.
Currently my code looks like this:
from win32com.client import Dispatch
import os
psApp = Dispatch("Photoshop.Application")
folder = 'C:\\This\\is\\the\\path\\to\\my\\folder'
for root, direc, files in os.walk(folder):
for file in files:
image = os.path.join(root, file)
doc = psApp.Open(image)
doc.Selection.Deselect()
psApp.DoAction('Action Folder', 'Action')
Thus far I have tried deleting steps from my action inoreder to determain which step is giveing me the error. Up until the point where all i'm doing is changeing the image size nad it still doesn't work.
Attached is screenshot of my action
Here's to hoping somone knows a thing or to about this api.
Alos I should mention that this error did not occer when running a defuault photoshop action.
psApp.DoAction('Action Folder', 'Action')
ExtendScript DOM uses the reverse order of the arguments. If I understand correctly, then python interacts with the DOM through win32com.
psApp.DoAction('Action', 'Action Folder')
Copy link to clipboard
Copied
Pardon my terrible typing. I'd like to fix my mistakes but i can't find a edit option.
Copy link to clipboard
Copied
Sothing else I probably need to mention. Running the action through photoshop works fine. It's when I run it via python that I get the error.
Copy link to clipboard
Copied
psApp.DoAction('Action Folder', 'Action')
ExtendScript DOM uses the reverse order of the arguments. If I understand correctly, then python interacts with the DOM through win32com.
psApp.DoAction('Action', 'Action Folder')
Copy link to clipboard
Copied
I could kiss you
Copy link to clipboard
Copied
It seems like you are having trouble running an action via Python in Photoshop. According to the error message you received, it seems like the 'play' command is not currently available. After doing some research, you found out that this error message can occur when some step in the action is not behaving as it should.
You have already tried deleting steps from the action to determine which step is causing the error, but even when you are only changing the image size, the error still occurs.
It's great that you are using an API to control Photoshop with Python, and I would recommend checking if the API is compatible with the version of Photoshop you are using. Additionally, you may want to try running the action manually in Photoshop to see if you can identify the step that is causing the error.
If you are interested in learning more about Java programming, you may want to check out this free course It covers the basics of Java programming and could be a helpful resource in your programming journey.