【问题标题】:Using an applescript/automator to attach multiple items to a new Outlook message使用 applescript/automator 将多个项目附加到新的 Outlook 邮件
【发布时间】:2016-08-16 19:53:06
【问题描述】:

我已经研究出(在网上找到)如何将单个项目从 Finder 附加到新的 Outlook 邮件中。我已经大量使用这种格式 - 更改了“selecteditem”和选择以及其他一些更重大的更改 - 但我无法弄清楚如何一次将多个项目附加到新的 Outlook 消息中。

只有一个项目附加到每条新的 Outlook 消息。 Automator 中没有 Outlook Automator 选项 - 我认为 Office 365 取消了它们。

我目前的脚本如下:

tell application "Finder" to set selectedItem to item 1 of (get selection)
set theAttachment to selectedItem as alias
set fileName to name of selectedItem

  tell application "Microsoft Outlook"
  set newMessage to make new outgoing message with properties {subject:fileName}
tell newMessage
   make new attachment with properties {file:theAttachment}
  end tell
  open newMessage
  get newMessage 
end tell

我目前正在尝试在 Automator 中使用此脚本作为服务,因此我有一个右键单击选项可以将文件直接发送到新的 Outlook 邮件。目前是这样设置的。

【问题讨论】:

  • 指令“新建附件”只添加一个文件。对于要添加 x 个文件的每个文件,必须在循环中使用它。将您选择的文件设置在一个列表中,并对该列表的每个项目重复。
  • 知道如何调整上述脚本来做到这一点吗?

标签: macos outlook applescript ms-office automator


【解决方案1】:

您的 Automator 服务从 Finder 获取“文件或文件夹”。这部分没问题。只是applescript的内容必须改变。

要读取这些输入(从 Finder 中选择的文件),您必须使用“on run”处理程序,其中“input”将是选择的文件。

下面的脚本必须替换您当前的脚本。我假设您的电子邮件主题应该是第一个选择的文件的名称,以防多选:

on run {input, parameters}
set SelectedItems to input
tell application "Finder" to set fileName to name of first item of SelectedItems

tell application "Microsoft Outlook"
    set newMessage to make new outgoing message with properties {subject:fileName}
    tell newMessage
        repeat with aFile in SelectedItems -- the loop through all selected items
            make new attachment with properties {file:aFile}
        end repeat
    end tell
    open newMessage
    get newMessage
end tell
return input
end run 

除此之外,我还有 2 个 cmets:

1) 当您选择文件夹时,此脚本不会过滤大小写。在循环内部,您可能需要添加一个“if”测试来检查文件或文件夹,并在选择是文件夹时采取措施。

2) 我不明白您要执行的整个过程:选择文件,转到菜单服务以运行此服务,它会创建一个带有这些文件作为附件的新 Outlook 消息...您可以通过以下方式完成所有这些操作选择文件并将它们拖放到停靠栏中的 Outlook 图标上。它会立即创建一个包含所有附件的新空白消息。

【讨论】:

  • 完美 - 谢谢你,这就是我想要的。 1)这不是问题 2)我想选择文件 - 右键/双击然后单击列表底部的 将文件发送到新的 Outlook 消息。我不知道我可以将文件拖到 Dock 上的 Outlook - 很高兴知道,我只是不确定它是否像右键单击选项一样快。感谢您的帮助 - 非常感谢。
猜你喜欢
  • 2015-11-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-08-29
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多