我正在处理一个保持开放(闲置)的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
答案 0 :(得分: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