Applescript: How to open files in repeat loop
So, I’m a completely newbie on this applescript thing.
What I’m trying to archive with this script that runs in a automator 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 managed to archive.
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? I get no error messages when running it.
here's my script
---------------------------
on run {input, parameters}
tell application "Finder"
set mlist to every file of folder "Macintosh HD:Users:matmil: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 mlistset cur_ext to name extension of this_fileset 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:matmil:Desktop:drop"move this_file to new_foldertell application "Adobe Photoshop CC 2014"
activate
open this_file <-- Is this what I'm doing wrong?
do action “cool effects" from "cool effects folder"
end tell end repeat
end tell
return input
end run
MacBook Pro (Retina, 13-inch, Mid 2014), OS X Yosemite (10.10.5), null