使用applescript/automator将多个项目附加到新的Outlook邮件中 [英] Using an applescript/automator to attach multiple items to a new Outlook message

查看:190
本文介绍了使用applescript/automator将多个项目附加到新的Outlook邮件中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经解决(在线找到)如何将Finder中的单个项目附加到新的Outlook邮件中.我已经使用这种格式进行了大量的工作-更改了'selecteditem'和selection以及其他一些更重要的更改-但我不知道如何一次获得多个附加到新的Outlook邮件上的项目.

I've worked out (found online) how to attach a single item from Finder to a new Outlook message. I've played with this format a good amount - changed 'selecteditem' and selection and some other more major changes - but I can't work out how to get more than one item to attach to a new outlook message at a time.

每条新的Outlook邮件仅附加一个项目. Automator中没有Outlook Automator选项-我认为Office 365取消了它们.

Only a single item attaches to each new outlook message. There are no Outlook Automator options in Automator - I think Office 365 did away with them.

我当前的脚本如下:

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邮件.目前是这样设置的.

I'm currently trying use this script in Automator as a service so I have a right click option to send files directly to a new Outlook message. It's currently setup like this.

推荐答案

您的Automator服务从Finder获取文件或文件夹".这部分没问题.只需更改applescript的内容即可.

Your Automator Service gets "Files or Folders" from Finder. This part is OK. Just the content of the applescript must be changed.

要读取这些输入(从Finder中选择的文件),必须使用运行中"处理程序,其中输入"将是所选文件.

To read these inputs (the selected files from Finder), you must use the "on run" handler where "input" will be the selected files.

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

The script bellow must replace your current script. I assumed that the subject of your email should be the name of the first selected file in case of multiple selection:

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条评论:

On top of that, I have 2 comments :

1)当您选择文件夹时,此脚本不会筛选大小写.在循环内部,您可能希望添加"if"测试以检查文件或文件夹,并在选择的是文件夹的情况下采取措施.

1) this script does not filter the case when you select a folder. Inside the loop, you may want to add a "if" test to check file or folder and take action in case selection is a folder.

2)我不了解要执行的总体过程:选择文件,转到菜单服务以运行此服务,该服务会创建一个新的Outlook邮件,并将这些文件作为附件...您可以通过以下方式完成所有操作:选择文件并将其拖放到扩展坞的Outlook图标上.它将立即创建一个包含所有附件的新空白消息.

2) I do not understand the overall process you want to perform: Select files, go to menu Service to run this service, which creates a new Outlook message with these files as attachment...You can do all this by just selecting the files and drag/drop them on the Outlook icon in the dock. it will immediately create a new blank message with all the attached files.

这篇关于使用applescript/automator将多个项目附加到新的Outlook邮件中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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