大佬教程收集整理的这篇文章主要介绍了使用 AppleScript / JXA 在 Apple Mail 中获取电子邮件 URL,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
可以通过多个 Mac OS 应用程序的唯一 URL 访问 Apple Mail 中的特定电子邮件。 URL 的格式为:message://%3c
我想要一个 AppleScript(或 JXA)脚本,当我在 Apple Mail 中并选择了几条消息时,它会为当前选择的每条消息生成这样的 URL,并将这些 URL 放在剪贴板中,以换行符分隔,允许我将它们粘贴到其他应用程序中。
这是我到目前为止所拥有的,实现了这一点:
tell application "Mail"
set _sel to SELEction
set _links to {}
repeat with _msg in _sel
-- Workaround for getTing the actual message-ID. This is necessary in situations when this is a redirected message. For such redirected messages,Apple Mail sets the "message ID" to "Redirect-message-ID". However,the URL will not be recognised by Apple Mail by "Redirect-message-ID",only by "message-ID".
tell _msg
set headerText to all headers
end tell
set parsedText to do sHell script "egrep ^message-ID: <<< " & quoted form of headerText
set AppleScript's text item delimiters to "message-ID: <"
set parsedText to text item 2 of parsedText
set AppleScript's text item delimiters to ">"
set parsedText to text item 1 of parsedText
-- Generate Markdown format URl. Looks like [subject](URL to messagE).
set _messageURL to "[" & subject of _msg & "](message://%3c" & parsedText & "%3E)"
set end of _links to _messageURL
end repeat
-- For some reason,it sometimes happens to have duplicates. Deduplicate here.
set AppleScript's text item delimiters to character ID 10
set theString to _links as String
set AppleScript's text item delimiters to ""
set sortedList to every paragraph of (do sHell script "/bin/echo -n " & quoted form of theString & "| sort -u")
set AppleScript's text item delimiters to return
set the clipboard to (sortedList as String)
--return (_links as String)
end tell
这有效,但是我遇到的最大问题如下。有时我已经回复了特定的电子邮件。如果是这样,我希望 URL 指向我的回复,以提醒我我已经回复了。当然,我的回复正文也会包含原始电子邮件。我不知道该怎么做。我需要做类似的事情:
其他问题:
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)
以上是大佬教程为你收集整理的使用 AppleScript / JXA 在 Apple Mail 中获取电子邮件 URL全部内容,希望文章能够帮你解决使用 AppleScript / JXA 在 Apple Mail 中获取电子邮件 URL所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。