Outlook For Mac 2016 Set Applescript To Run
Attaching files to e-mail
- Outlook For Mac 2016 Set Applescript To Runway
- Outlook For Mac 2016 Set Applescript To Run Faster
- Outlook For Mac 2016 Set Applescript To Run
I often want to attach files from Finder to a new e-mail, and I use Outlook from Office 365 on Mac OS Sierra (and now updated for MacOS Mojave).
I know you can drag the selected file(s) to the Outlook icon in the Dock. But this is often an extra action. I just want to right click, and “Share”, or similar.
Apparently Outlook 2016 (Office 365) does not ship anymore with the handy Automater scripts that used to accompany Outlook.
This is very possible with AppleScript. Here's an example with the basics: tell application 'Microsoft Outlook' set theContent to ' set theMessages to messages of folder 'Inbox' of default account repeat with theMessage in theMessages if subject of theMessage contains 'match this string' then set theContent to theContent & plain text content of theMessage end if end repeat set theMessage to. However for my work email I use Outlook 2016 for Mac. It does support rules but I have found them to be somewhat lacking. The UI for setting them up is hard work, as is testing that they are working as expected. Run AppleScript from the Command Line in Mac OS X with osascript Aug 19, 2016 - 3 Comments Mac users can run AppleScript from the command line if desired, either by running a script file directly or by giving the osascript command direct plain text script statements. If you use Outlook 2016 for Mac in more than one capacity, such as for your personal life and for work, you can set up Outlook to handle these different capacities by using profiles.A profile is associated with and stores a set of email messages, contacts, tasks, calendars, account settings, Scrapbook clips,. Install Office 2016 on a PC. Remember a one-time purchase version of Office is licensed for one install only. Depending on your browser, select Run (in Edge or Internet Explorer), Setup (in Chrome), or Save File (in Firefox). If you see the User Account Control prompt that says, Do you want to allow this app to make changes to your device.
Using Applescript and Automator
After searching around the internet for different options, I found out that using Applescript together with Automator is the easiest way to do this.
In Automator:
- create a new:
- Service (
File->new->Service
) under MacOS Sierra - Quick Action (
File->new->Quick Action
) under MacOS Mojave
- Service (
- At the top right, make sure you select that the services receives selected ‘Files or folders’ in ‘Finder.App’.
- Then from the left Action menu, search for
Run Applescript
and drag that to the window on the right. - For the script insert:
- Then save the service (
File->Save
). The name of the file will be the name in the Finder right-click menu! (I used: ‘Attach to Outlook e-mail.workflow')
Attach menu option available
Now when you go to Finder, select one or more files, and then right-click, you will see ‘Attach to Outlook e-mail’ at the bottom of the menu! Woohoo!
Breakdown
So what does the Applescript do? Let’s break it down.
- When the service is called (from Finder), save the selected files to the
SelectedItems
variable.
- Then let Outlook create a new e-mail message in
newMessage
- And add all files from
SelectedItems
as attachments to the e-mail
- Don’t forget to open the new message (otherwise it stays in ‘Drafts’)
Outlook For Mac 2016 Set Applescript To Runway
- And show Outlook, otherwise it might happen on a different Desktop.