Folderactionscript with a Photoshop Action

Hi,

I want to create a folderactionscript with a Photoshop Action.
When a file is in the folder Photoshop should start and make the action. After this action the file in these folder must delete.
The name of the action is “Quetschen” and the name if the set is “rata.atn”.

Can someone help me?

Hi,

this sounds useless, :wink:
do you want to save the changed file somewhere else?

Yes, the changed files must save to another place.

Browser: Safari 523.10
Operating System: Mac OS X (10.5)

try this, you can specify the destination folder in the second line (must be a HFS path string with a colon at the end)

on adding folder items to this_folder after receiving added_items
	set destinationFolder to (path to desktop as text)
	set deleteList to {}
	repeat with oneItem in added_items
		set {kind:Ki, name:Nm} to info for oneItem
		if Ki contains "Photoshop" then
			tell application "Adobe Photoshop CS3"
				open oneItem
				do action "Quetschen" from "rata.atn"
				save current document in file (destinationFolder & Nm)
				close current document saving no
			end tell
			set end of deleteList to contents of oneItem
		end if
	end repeat
	if deleteList is not {} then tell application "Finder" to delete deleteList
end adding folder items to

Hi,

thank you for the script. The script came up with an error.
Error message (in german): Es wurde “zeilenende, etc.” erwartet, aber “Identifer” wurde gefunden.

What kind of error is this?

Thanks
Uwe

Uwe, it would be very helpful to know, in which line the error occurs

Stefan, after i try to run the script, the word “action” in the line “do action “Quetschen” from “rata.atn”” is activated.

Uwe

I’ve tested the script with an action from Standardactions, though not as a folder action.
I guess there is a terminology conflict with the folder action handler, try this instead


on adding folder items to this_folder after receiving added_items
	set destinationFolder to (path to desktop as text)
	set deleteList to {}
	repeat with oneItem in added_items
		set {kind:Ki, name:Nm} to info for oneItem
		if Ki contains "Photoshop" then
			do_PS_action(oneItem, destinationFolder, Nm)
			set end of deleteList to contents of oneItem
		end if
	end repeat
	if deleteList is not {} then tell application "Finder" to delete deleteList
end adding folder items to

on do_PS_action(I, D, N)
	tell application "Adobe Photoshop CS3"
		open I
		do action "Quetschen" from "rata.atn"
		save current document in file (D & N)
		close current document saving no
	end tell
end do_PS_action

Hi Stefan,

the script works. Thank you. But the files in the “in” folder are not only Photoshop. The files are in the “tiff” fomat generate from a RIP. Can we change this in the script?

Uwe

Browser: Safari 523.10
Operating System: Mac OS X (10.5)

Hi Stefan,

another question:
when i put one file in the folder it works fine. But when i put a lot files in the folder it works not.
What is wrong?
Uwe

Browser: Safari 523.10
Operating System: Mac OS X (10.5)

hm, the script should work also with multiple files.
I removed the kind check


on adding folder items to this_folder after receiving added_items
	set destinationFolder to (path to desktop as text)
	set deleteList to {}
	repeat with oneItem in added_items
		try
			do_PS_action(oneItem, (destinationFolder & name of (info for oneItem)))
			set end of deleteList to contents of oneItem
		end try
	end repeat
	if deleteList is not {} then tell application "Finder" to delete deleteList
end adding folder items to

on do_PS_action(I, N)
	tell application "Adobe Photoshop CS3"
		open I
		do action "Quetschen" from "rata.atn"
		save current document in file N
		close current document saving no
	end tell
end do_PS_action

Hi Stefan,

thank you. Now it works fine.
A last question. Is it possible to delete the files in the “in” folder after user the script?

regards
Uwe

this deletes all added items after processing them


on adding folder items to this_folder after receiving added_items
	set destinationFolder to (path to desktop as text)
	repeat with oneItem in added_items
		try
			do_PS_action(oneItem, (destinationFolder & name of (info for oneItem)))
		end try
	end repeat
	tell application "Finder" to delete added_items
end adding folder items to
.