Skip to main content
Participant
September 13, 2015
Question

How to open files in repeat loop in Photoshop

  • September 13, 2015
  • 1 reply
  • 721 views

So, I’m a completely newbie on this applescript thing. 

What I’m trying to archive with this script that runs in a automator-watched folder is:

If image(s) file(s) is added to this specific folder do this:

1. Create a new folder

2. Give the folder the same name as the new file

3. Move the file to the corresponding folder.

So far, the steps above I manages to archive, but:

The next step I want to be able to do is to open the moved file in Photoshop and run a photoshop action on it. I’ve tried “open this_file” but it doesn’t open it. Any ideas on how to solve this?

this is my script:

-------------

on run {input, parameters}

tell
application "Finder"
set
mlist to every file of folder "Macintosh HD:Users:matrik:Desktop:drop" whose (name ends with ".jpg" or name ends with ".jpeg" or name ends with ".png" or name ends with ".gif")
repeat with
this_file in mlist
set
cur_ext to name extension of this_file
set
new_name to text 1 thru -((length of cur_ext) + 2) of (name of this_file as text)
set
new_folder to make new folder with properties {name:new_name} at folder "Macintosh HD:Users:matrik:Desktop:drop"

move this_file to new_folder

set this_file to this_file as alias


tell application "Adobe Photoshop CC 2014"

activate

open this_file <-- Is this what I'm doing wrong?

do action “cool effects" from “my effects"

end tell

end repeat
end tell

return
input

end run

This topic has been closed for replies.

1 reply

Inspiring
September 14, 2015

Hi patrikb64133894,

This is untested, try replacing this block:

set this_file to this_file as alias


tell application "Adobe Photoshop CC 2014"

activate

open this_file <-- Is this what I'm doing wrong?

do action “cool effects" from “my effects"

end tell

With this:

set new_Foldername to "Macintosh HD:Users:matrik:Desktop:drop:" & new_name

tell application "Finder"

        set newlist to every file of folder new_Foldername

        set new_file to item 1 of newlist as string

end tell

tell application "Adobe Photoshop CC 2014"

       open alias new_file

        do action "cool effects" from "my effects"

end tell



greenrookie