【发布时间】:2014-07-15 08:38:17
【问题描述】:
我正在使用这个 AppleScript 来获取所选电子邮件的内容:
using terms from application "Mail"
on run {input, parameters}
set mailContents to {}
repeat with aMessage in input
set end of mailContents to content of aMessage
end repeat
return mailContents
end run
end using terms from
结果如下:
{"

Here's some text followed by a longer URL, which is cut by a line break!
http://www.XYZ.net/diario/actualidad/economia/20140714/-ciudad-bar
ata-para-el-turismo_353_34541.html
"}
我想使用这些特定邮件中的所有链接进行处理,但不能使用前面示例中看到的分割 URL。 那么如何告诉 AppleScript 将 URL 保持在一起呢?
【问题讨论】:
-
如果每个 URL 链接都被分成两段,那么就在您的重复循环中,搜索 aMessage 中以“http:”开头的行并删除它末尾的段落标记。
-
谢谢@jweaks!只是对一行很长的 URL 会被拆分。知道如何删除段落标记吗?我尝试了十几种不同的想法,但无法实现。 ;(
-
嗯,使用 do shell script grep 行匹配行并删除段落标记会很容易。
标签: applescript automator