【发布时间】:2013-07-28 17:22:13
【问题描述】:
我正在运行以下小程序:
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) 来传递给自动机
++++++++++++++编辑
到目前为止,我已经掌握了它,但是当我需要所有项目时,我一次只能传递列表中的一项。
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
+++++++++++EDIT2
这个脚本在自动机中工作:
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
谢谢
【问题讨论】:
标签: path applescript finder