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”.
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
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.
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
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)
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
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
.