Having troubles running an action via Python
- August 4, 2021
- 3 replies
- 4469 views
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.
