0

嗨,我正在尝试创建一个 Applescript 来执行以下操作:

一周以来,我的硬盘上有几个 jpg 和 eps 文件。我有两个文件夹:矢量和图像。几天后,我得到了几十个这样的混合文件,我必须手动选择并移动到其各自的文件夹中。

如何将 .eps 移至 VECTOR 文件夹,将 jpg 移至 IMAGES 文件夹。我对applescripting一无所知,所以我复制了其他脚本的一部分并将其放在一起:

在运行 {输入,参数} - 复制

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!

4

1 回答 1

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
于 2013-02-28T18:07:40.137 回答