Photoshop Scripts

Hi,

i want to write a skript that starts Photoshop and tells it to run a Batch skript (created in Photoshop) over a Folder that i give.
I tryed to write this in a batchfile but noone knew how to control Photoshop in a batchskript so maybe its possible to do this in an AppleScript.

Model: MacBook
AppleScript: 1.10.7
Browser: Safari 419.3
Operating System: Mac OS X (10.4)

WELCOME TO THE FORUM

I don’t think you can call a batch process from applescript but you can call a photoshop action


tell application "Adobe Photoshop CS2"

		do action "your actions" from "Your default actions.atn"
end tell

You then get applescript to create the batch parameters


set processFolder to choose folder with prompt "Choose a folder that contains images to process"
set targetFolder to choose folder with prompt "Choose a folder to save processed images"
set listImages to list folder processFolder without invisibles
repeat with i from 1 to (length of listImages)
	set thisimage to item i of listImages
	set image_file_path to (processFolder & thisimage as string)
	
	tell application "Adobe Photoshop CS2"
		open file image_file_path
		do action "your actions" from "Your default actions.atn"
		save current document as JPEG in targetFolder
		close current document
	end tell
end repeat

Hope this helps

Model: 2 G5’s duals, Intel Imac, powerbook…
AppleScript: Version 2.1.1 (81)
Browser: Safari 412.2
Operating System: Mac OS X (10.4)

Sry but i didnt get everything of it:
what do you mean by “your actions” and “Your default actions.atn”?
My action is called “wsbash” but what is its default action?

please replace “your actions” with the name of your action ie “wsbash”
that action will be in a group in your actions pallette. so replace “your default actions,atn” with the name of your group and include the .atn

Then there is a failure called “the file “some object” could not be found”

I need more infomation. please post your script and make sure that you type the action names exactly as they appear in photoshop.
You do have CS2 ??

Yes, i do have PhotoshopCS2 from the CS2 Suite. The Photoshopaction i wrote is called “wsbash” and its in the folder “eigenen” . I just copied your script so now i have


set processFolder to choose folder with prompt "Choose a folder that contains images to process"
set targetFolder to choose folder with prompt "Choose a folder to save processed images"
set listImages to list folder processFolder without invisibles
repeat with i from 1 to (length of listImages)
	set thisimage to item i of listImages
	set image_file_path to (processFolder & thisimage as string)
	
	tell application "Adobe Photoshop CS2"
		open file image_file_path
		do action "wsbash" from "eigenen.atn"
		save current document as JPEG in targetFolder
		close current document
	end tell
end repeat

Works fine for me. Run the event log in script editor and find out where it is failing

I tried the script with different actions and different pictures, always the same problem: in the log file he finds the images but when he shall open them in PhotoShop, the failure i descriped stops the action.

try adding alias

tell application “Adobe Photoshop CS2”
open file alias image_file_path
edn tell

the failure is now that he cant read the file but when i try to open the file direktly in Photoshop, its no problem at all

could you copy and paste the event log?

tell current application
choose folder with prompt “Choose a folder that contains images to process”
alias “Macintosh HD:Users:maximiliankirchner:Pictures:Photoshop:Eingabe:”
choose folder with prompt “Choose a folder to save processed images”
alias “Macintosh HD:Users:maximiliankirchner:Pictures:Photoshop:Website:test:”
list folder alias “Macintosh HD:Users:maximiliankirchner:Pictures:Photoshop:Eingabe:” without invisibles
{“party1.jpg”, “party2.jpg”, “party3.jpg”, “party4.jpg”, “party5.jpg”, “party6.jpg”}
end tell
tell application “Adobe Photoshop CS2”
get alias “Macintosh HD:Users:maximiliankirchner:Pictures:Photoshop:Eingabe:,party1.jpg”
“žAdobe Photoshop CS2” hat einen Fehler erhalten: žalias "Macintosh HD:Users:maximiliankirchner:Pictures:Photoshop:Eingabe:,party1.jpg"" kann nicht gelesen werden."

the last line is in german (i’m german) so i will translate it: žAdobe Photoshop CS2" has got a failure: žalias "Macintosh HD:Users:maximiliankirchner:Pictures:Photoshop:Eingabe:,party1.jpg"" could not be read."

take out the alias and try again. copy and paste the event log

take the file off your open line so that it reads:
open image_file_path

What is happening is that the “File” is used when you are passing a path as a string to PhotoShop. Since you are passing an alias to it the “File” is redundant and PS no longer knows how to handle the line. You could also coerce the alias to a string (or text) and keep the “file” designator in and it will work, but since you already have an alias it would be easier to just pass that to PS.

thanks a lot, i changed the line to “open image_file_path” but now there are 2 other problems: at first he says during the action that the commands in the actionskript are not available at the moment and in the line “save current document as JPEG in targetFolder” he says that he expected a folder

For the save line change it to:

save current document in targetFolder as JPEG

The do action command looks right, make sure that the name of the action and the action set are exactly the same. My guess is that your action sets name is “eigenen” and not “eigenen.atn” and so the script cannot find the action that you are trying to run.

Next make sure that they are active. You can turn off a step or an entire action, if they are turned off (no check mark in the far left box in the pallet in front of the action name) then nothing will happen.

Now, it were me I would try to the steps of the action in the script rather than having an action. This may or may not be possible, but if it is something like convert to RGB, resample to 72 dpi, then there really is no need for the action and you don’t have to worry about ensuring that the action is loaded on the computer and active.

Thanks a lot for all the help until here but there are still 2 Problems left:

  1. Photoshop finds the action and tries to do all the commands in it, but at eacht command it says that the command is not available at the moment (maybe he didnt load the photos beacause i dont see Photoshop openi2ng any Photos)
  2. It says at “save current document in targetFolder as JPEG” that it expected a Folder

What are you trying to do with the action? It is possible that it is relying on something that was in the file that you recorded it with but not in the file that you are trying to apply the action to, it is hard to day without having the action and the script to trouble shoot. If you could save the action out as a .atn file and send it to me I might be able to take a look at it and see if there is an obvious problem.

I tested the skript with two different actions: at first one that just resizes the image to a width of 800pixels and anotherone that marks all of the image and reverses the color. Both skripts work well if i go on the bash command and choose the folder.
If can tell me how to export the actions i can post them