Mac Automator / Applescript(?)从邮件中提取URL [英] Mac Automator/Applescript(?) to extract URL's from Mail messages

查看:969
本文介绍了Mac Automator / Applescript(?)从邮件中提取URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试获取位于最新的Mac Mail.app(OS X 10.10.2 Yosemite)中的一堆电子邮件中的任何链接的文本文档列表,并且被简单地忽略。

I'm trying to get a text document list of any links in a bunch of email messages that reside in the latest Mac Mail.app (OS X 10.10.2 Yosemite), and am simply stumped.

我以为我可以只是...

I thought I'd be able to just...


  1. 放几个Automator。

  2. 选择/突出显示Mail.app内的所有电子邮件,

  3. 选择该服务或运行该服务工作流程

  4. 还有一个文本文件,每个URL /链接都可以在其中找到。

  1. Put a couple of Automator.app actions together in a Service/Workflow,
  2. Select/highlight all the email messages within the Mail.app,
  3. Select that Service or run that Workflow,
  4. And have a text document with every URL/link that could be found within them all.

但是,这没有办法。

我想知道如何一次使用一个电子邮件,但是这不是我想要的。附件是3个工作流程的截图。第一个是只有一个电子邮件消息&突出显示其中的所有文字&运行服务。另外两个只是根本不起作用。

I figured out how to do this with one email message at a time, but that's not what I want. attached is a screenshot of 3 workflows. The first one is the one that works with just one email message & highlighting all the text in it & running the Service. the other two just simply don't work.

我还注意到第一个显示在服务菜单中,打开一个电子邮件;一旦我突出显示多个电子邮件,该选项将从服务菜单中移除。

I also notice that the the first shows up in the Service Menu with a single email open; once I highlight more than one email message, the option goes away from the Service menu.

任何提示或技巧?

推荐答案

我想到了如何达到目标,首先在Automator中创建一个新服务(输入:无输入,应用程序:邮件)

I figured out how you could reach your goal, start with creating a new service within Automator (input: "No input", application: "Mail")

第一个动作是获取所选邮件(获取所选邮件)

The first action is Get Selected Mail Messages (Get selected: messages)

第二个动作是 Exceute AppleScript 使用以下脚本:

The second action is Exceute AppleScript with the following script:

on run {input, parameters}
    set mailContentList to {}
    tell application "Mail"
        repeat with selectedMail in input
            set end of mailContentList to content of selectedMail
        end repeat
    end tell
    return mailContentList
end run

这个脚本只是浏览给定的消息,读出内容并将此列表传递给下一个动作

第三个动作是提取URL来自文本

最后的动作是 New TextEdit Document

保存一个很好的名字,如从所选邮件中提取URL
此后,该服务可在邮件​​应用程序的服务菜单中使用。

Save it with a nice name like Extract URLs from selected mails After that the Service is available inside the Services menu inside the Mail app.

在我的测试中,我发现一些没有http://的链接到锚点的内部URL,所以也许你想删除所有不以 http 开头的URL。您可以在创建新的TextEdit文档之前使用另一个操作来执行此操作:

过滤段落,其中的选项以 http (不知道这些参数在英文中是如何调用Automator的,对不起)

In my test I found a few internal URLs without http:// from links to anchors, so maybe you want to delete all URLs that do not start with http. You can do so by using another action before creating the new TextEdit document:
Filter Paragraphs with options "Paragraphs that start with http" (don't know how these parameters are called in English Automator, sorry)

感觉不错,Michael / Hamburg

Feel good, Michael / Hamburg

这篇关于Mac Automator / Applescript(?)从邮件中提取URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆