【发布时间】:2011-11-30 05:27:19
【问题描述】:
另一个新手applescript问题。我试图在打开文件夹时获取文件夹内所有文件夹和文件的绝对路径。我想写一些类似的东西
on opening folder this_folder
tell application "Finder"
set everyPath to POSIX path of every item in entire contents of this_folder
end tell
repeat with n from 1 to count of everyPath
display dialog item n of everyPath
end repeat
end opening folder
但这是一块砖头,所以现在我有这个更丑陋的烂摊子。
on opening folder this_folder
tell application "Finder"
set everyName to name of every item in entire contents of this_folder
set everyPath to {}
repeat with n from 1 to count of everyName
set end of everyPath to POSIX path of item n of everyName
end repeat
end tell
repeat with n from 1 to count of everyPath
display dialog item n of everyPath
end repeat
end opening folder
当我在寻找更像“用户/用户名/文档/文件夹/file.ext”和“用户/用户名/文档/文件夹/子文件夹/file2.ext”的内容时,会显示像“/file.ext”这样的对话框'。
从我倾向于错过过去显而易见的事情来看,我假设有一种简单的方法可以获取我只是忘记的完整路径名,如果能帮助我整理它,我将不胜感激。谢谢!
【问题讨论】:
标签: macos applescript filepath