你在那里有一项艰巨的任务,因为你必须解决其中的许多部分。为了让您开始,这里有一些关于阅读一个 html 文件并将所有 src 图像放在一个 applescript 列表中的建议。你必须做的远不止这些,但这是一个开始。
首先,您可以将 html 文件作为常规文本读入 applescript。像这样的东西会得到一个html文件的文本......
set theFile to choose file
set htmlText to read theFile
将文本放入 applescript 后,您可以使用文本项分隔符来获取 src 图像。这是一个例子。无论html代码多么复杂,它都应该工作......
set htmlText to "<img src=\"smiley.gif\" alt=\"Smiley face\" height=\"42\" width=\"42\" />
<img src=\"smiley.gif\" alt=\"Smiley face\" height=\"42\" width=\"42\" />
<img src=\"smiley.gif\" alt=\"Smiley face\" height=\"42\" width=\"42\" />"
set text item delimiters to "src=\""
set a to text items of htmlText
if (count of a) is less than 2 then return
set imageList to {}
set text item delimiters to "\""
repeat with i from 2 to count of a
set thisImage to first text item of (item i of a)
set end of imageList to thisImage
end repeat
set text item delimiters to ""
return imageList
我希望这会有所帮助!