代码之家  ›  专栏  ›  技术社区  ›  ePi272314

如何在MacOS上的邮件应用程序中打开我在搜索结果中选择的邮件所在的文件夹/邮箱?

  •  -1
  • ePi272314  · 技术社区  · 6 年前

    在MacOS的邮件应用程序中,我使用了许多智能文件夹(显示预定义搜索条件结果的特定邮箱)。因此,这些智能邮箱显示来自不同帐户和文件夹的邮件。

    通常,我需要跳转到实际的邮箱/文件夹,其中包含结果列表中选定的邮件。我还有很多文件夹。

    其中一个 改进 (烦恼)在新的邮件应用程序中,我找不到这样做的方法。在过去的MacOS版本中(至少对于小牛来说)这很简单。我可以像在其他许多应用程序中一样做。看图片。

    enter image description here

    上一个技巧在邮件应用程序的消息窗口中不再有效。

    是否有任何方法可以跳转或打开我在搜索结果或智能邮箱中选择的邮件所在的邮箱/文件夹?

    1 回复  |  直到 6 年前
        1
  •  0
  •   ePi272314    6 年前

    用automator+applescript解决方案

    我找到的解决方案是创建一个自动机服务,并有选择地将其与快捷方式相关联。

    1. 打开自动机。
    2. 新文件。
    3. 选择 Service 对于文档类型。
    4. 在窗口顶部,设置此服务的输入类型:
      Service receives selected 选择 no input
      in 选择 Mail.app
    5. 在操作库(左窗格)中找到操作 Run AppleScript .
    6. 在工作流区域中拖放它。
    7. 复制此答案末尾的代码并将其粘贴到操作中 运行applescript 是的。
    8. 保存您的服务(例如“跳转到文件夹”)。

    测试服务

    测试服务时,automator可以保持打开状态,也可以保持邮件应用程序的打开状态。

    1. 打开邮件应用程序。
    2. 执行搜索并选择一条消息,最好是位于自定义文件夹中的消息。
    3. 在菜单栏中转到 Mail gt; Services .你应该看看你的新服务。
    4. 选择服务。

    所选且活动的邮箱/文件夹应是以前所选邮件的邮箱。

    可选。为您的服务指定快捷方式:

    1. 打开系统首选项。
    2. Keyboard > Shortcuts
    3. 在左窗格中选择 服务
    4. 在右窗格的末尾 General 你应该找到你的服务
    5. 为它指定一个快捷方式(例如 命令 - 选择权 - J )

    守则

    set theDialogTitle to "Go to Folder Script"
    
    tell application "Mail"
    
        -- Get the selected messages and the count of them
        set theMessageList to selected messages of message viewer 1
        set theCount to length of theMessageList
    
        -- Error if no messages
        if theCount is 0 then
            display dialog ¬
                "No message selected." with title theDialogTitle buttons {"OK"} with icon caution
            return
        end if
    
        -- Error if more than one message
        if theCount is greater than 1 then
            display dialog ¬
                "Must select only one message." with title theDialogTitle buttons {"OK"} with icon caution
            return
        end if
    
        -- Get the message
        set theMessage to item 1 of theMessageList
    
        -- Get the mailbox object
        set theMailbox to mailbox of theMessage
    
        -- Select the mailbox
        set selected mailboxes of message viewer 1 to theMailbox
    
    end tell