I need to pass to a .jsx script (a Photoshop script written in JavaScript) a list of image files as arguments when they are added to a folder. According to the Adobe documentation, you can call a .jsx in the following way:
tell application "Adobe Photoshop CS6"
do javascript (file "/path/myPhotoshopScritp.jsx") ¬
with arguments { "path/image1.jpg","path/image3.jpg","path/image4.jpg" }
end tell
I know that when a folder action workflow is triggered, the items that were added to the attached folder are passed to the workflow. But I have problems in referencing these items from AppleScript and dynamically compose the array you see in the last part of the script:
"path/image1.jpg","path/image3.jpg","path/image4.jpg"
I imagine it's a simple task, but AppleScript is not intuitive for me.
Best Answer
Use a
run
handler:Or if you need the input as a list of POSIX paths:
For a script saved directly in
/Library/Scripts/Folder Action Scripts/
, use anadding folder items
handler: