1

我正在运行以下小程序:

tell application "Finder"
set input to POSIX file "/Users/sam/Desktop/Resized"
set theFiles to (every file of folder input whose name does not contain "- Resized")
end tell

return theFiles

它正在正常工作,尽管它正在返回:

{document file "HighResCat.jpg" of folder "Resized" of folder "Desktop" of folder "sam" of    folder "Users" of startup disk of application "Finder", document file "madonna.jpg" of folder "Resized" of folder "Desktop" of folder "sam" of folder "Users" of startup disk of application "Finder"}

我需要一个 POSIX 路径(/Users/sam/Desktop/Resized/HighResCat.jpg)传递给 automator

++++++++++++++编辑

我已经做到了这一点,但是当我需要所有项目时,我一次只能通过列表中的一项。

tell application "Finder"
    set input to POSIX file "/Users/sam/Desktop/Resized"
    set theFiles to (every file of folder input whose name does not contain "-  Resized")
set input to item 1 of theFiles as string
end tell


return (POSIX file input)

我转换为字符串并在返回时转换为 POSIX

+++++++++++编辑2

该脚本在 automator 内部工作:

on run {input, parameters}
set input to (input) as string
tell application "System Events" to set theFiles to POSIX path of (files of folder    input whose name does not contain "- Resized")
set input to theFiles
return input
end run

谢谢

4

1 回答 1

1

尝试:

set input to "/Users/sam/Desktop/Resized"
tell application "System Events" to set theFiles to POSIX path of (files of folder input whose name does not contain "- Resized")
return theFiles
于 2013-07-28T17:36:23.470 回答