我试图弄清楚如何在AppleScript中逐行迭代文件.类似于bash脚本,如下所示:
for LINE in $(cat file)
do
echo ${LINE}
done
Run Code Online (Sandbox Code Playgroud)
有小费吗?谢谢!
kdm*_*ray 10
我不能因为写这篇文章而受到赞扬,我从MacRumors论坛的帖子中回复了代码.
tell application "Finder"
set Names to paragraphs of (read (choose file with prompt "Pick text file containing track names"))
repeat with nextLine in Names
if length of nextLine is greater than 0 then
--Do something with the next name, which is stored in "nextLine"
end if
end repeat
end tell
Run Code Online (Sandbox Code Playgroud)
MacRumors论坛上的HexMonkey原始代码.
| 归档时间: |
|
| 查看次数: |
5627 次 |
| 最近记录: |