Hi everyone, i’m new to scripting and have 2 questions:
I am in need of a script that looks in a directory of files, pulls the names from the JPEG then moves the similar images into the corresponding directory.The closest I could find was a script that, once the JPEGs are selected creates folders from the JPEGS, then it moves the JPEG into the corresponding directory. here is the script I have:
tell application "Finder"
set current_folder to folder of front window
set x to (get the selection) as list
repeat with i from 1 to the count of x
set this_file to item i of x
if i is not 1 then
set previous_file to item (i - 1) of x
set prev_ext to cur_ext
set prev_name to new_name
else
set prev_name to ""
end if
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)
if new_name is not equal to prev_name then
set new_folder to make new folder with properties {name:new_name} at current_folder
move this_file to new_folder
else
move this_file to new_folder
end if
end repeat
end tell
here is what the directory looks like now:
13875980Medium_BN.psd
13875980Medium_SN.psd
13875980Medium.jpg
14507383Medium_BN.psd
14507383Medium_SN.psd
14507383Medium.jpg
14649968Medium_BN.psd
14649968Medium_SN.psd
14649968Medium.jpg
14905715Medium_BN.psd
14905715Medium_SN.psd
14905715Medium.jpg
16133522Medium_BN.psd
16133522Medium_SN.psd
16133522Medium.jpg
and here is what my desired end result would look like:
13875980Medium (directory containing all similar files with “.psd" in name)
13875980Medium.jpg
14507383Medium (directory containing all similar files with ".psd” in name)
14507383Medium.jpg
14649968Medium (directory containing all similar files with “.psd" in name)
14649968Medium.jpg
14905715Medium (directory containing all similar files with ".psd” in name)
14905715Medium.jpg
16133522Medium (directory containing all similar files with “_.psd” in name)
16133522Medium.jpg
and this leads me to the second part of my question, can I get some opinions on the best begining guide to applescripting that’s not too elemnetary, unless you all think I need that
I have some background in HTML writing and a basic understanding of applescripting. My main focus would be workflow automation involving and combining the OS, Photoshop and excel.
sorry is this post is too lengthy, it’s my first post and I want ot make sure it’s detailed.
thanks anyone for help, I truly appreciate it.
Robert