嗨,我正在尝试创建一个Applescript来执行以下操作:
在一周内,我的硬盘上有几个jpg和eps文件。我有两个文件夹:矢量和图像。 几天后,我得到几个这样的混合文件,我必须手动选择并移动到各自的文件夹。
如何将.eps移动到VECTOR文件夹和jpg到IMAGES文件夹。 我对applecripting一无所知,所以我复制了其他脚本的部分并将它们组合在一起:
运行{input,parameters} - 复制
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
结束
当然这是错的,但希望有人可以帮我把这个直截了当 日Thnx!
答案 0 :(得分:1)
我假设您从问题的表达方式将其纳入Automator工作流程。
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
如果没有,你可以使用:
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