1

我正在开发一个保持打开(空闲)的applescript来监视一个文件夹并处理每个传入的项目。但是,如果有的话,我无法遍历传入的文件。如何解决这个问题?

on idle
    tell application "Finder"

        -- Folders
        set InFolder to "Macintosh HD:Users:Nick:Documents:Applescript:Beeld bewerken:In:"
        set OutFolder to "Macintosh HD:Users:Nick:Documents:Applescript:Beeld bewerken:Out:"

        set MyFiles to (every file in folder ((InFolder) as text))
        set MyFiles to MyFiles as list

        set NumberOfFiles to (number of files in folder ((InFolder) as text))

    end tell

    if NumberOfFiles > 0 then
        repeat with i in MyFiles
            tell application "Adobe Photoshop CS6"

                open (item i of MyFiles)

                -- Edit item

            end tell
        end repeat
    end if
    return 10
end idle
4

1 回答 1

2

看起来您应该使用文件夹操作而不是空闲处理程序。将此文件夹操作附加到您的目标文件夹。

on adding folder items to theFolder after receiving droppedItems
    repeat with anItem in droppedItems
        tell application "Adobe Photoshop CS6" to open anItem
    end repeat
end adding folder items to
于 2013-11-13T12:23:27.740 回答