Reputation: 27
Hi, I'm trying to create an Applescript to do the following:
Over the week a have several jpg and eps files on my hard drive. I have two folders: Vector and Images. After some few days I get a few dozens of this mixed files which I have to manually select and move to its respective folder.
How can I move the .eps to the VECTOR folder and the jpg to IMAGES folder. I don´t know anything about applescripting, so I copied parts of other scripts and put this together:
on run {input, parameters} -- copy
if theExtension is "eps" then
set destination to ~/user/Desktop/VECTO
end if
tell application "Finder"
move anItem to destination
if theExtension is "jpg" then
set destination to ~/user/Desktop/IMAGO
end if
tell application "Finder"
move anItem to destination
end run
Of course it is wrong, but wish someone could help me put this straight Thnx!
Upvotes: 0
Views: 1454
Reputation: 11238
I assume you are incorporating this into an Automator workflow from the way the question is phrased.
on run {input, parameters} -- copy
repeat with aFile in input
tell application "Finder"
if name extension of aFile is "eps" then
move aFile to folder ((path to desktop as text) & "VECTO")
else if name extension of aFile is "jpg" then
move aFile to folder ((path to desktop as text) & "IMAGO")
end if
end tell
end repeat
end run
If not you can use:
set myFiles to (choose file with multiple selections allowed)
repeat with aFile in myFiles
tell application "Finder"
if name extension of aFile is "eps" then
move aFile to folder ((path to desktop as text) & "VECTO")
else if name extension of aFile is "jpg" then
move aFile to folder ((path to desktop as text) & "IMAGO")
end if
end tell
end repeat
Upvotes: 1