Notifications
Clear all

[Closed] Run JS in Photoshop from maxscript

This is how to open the file a.tiff

	pshop=CreateOLEObject"Photoshop.Application"
 	pshop.Visible=true
 	pshop.open "d:\\fff\\a.tiff"

but how to apply the script_.js to this image inside Photoshop, then save a.jpg to the same folder from maxscript?

2 Replies
 MZ1

You cannot run a java script directly by using OLE object, but you can run an action. So, do the following steps:

Inside Photoshop:

  • Create an Action-Set and name it “Action Set”.
  • Create an Action inside that set and name it “Action Name”.
  • When action is recording, run your .jsx from menu File/Scripts/Browse.
    So now you have an action which runs your java script.

Inside Max:

ImageFileName = "d:\\fff\\a.tiff"

PsApp = CreateOLEObject "Photoshop.Application"
PsApp.open ImageFileName
PsApp.bringToFront()
PsApp.doaction "Action Name" "Action Set"

Thank you, Mehdi! It’s working great!!!