1

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.

1

Use a run handler:

on run {input, parameters}
    input
end run

Or if you need the input as a list of POSIX paths:

on run {input, parameters}
    set l to {}
    repeat with f in input
        set end of l to POSIX path of f
    end repeat
end run

For a script saved directly in /Library/Scripts/Folder Action Scripts/, use an adding folder items handler:

on adding folder items to this_folder after receiving added_items
    added_items
end addin

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .