You are on page 1of 41

Outlook for Mac Scripts | A Resource for using Scripts in OS X 10/2/13 10:05 PM

A Resource for using Scripts


in OS X
Save time and add features to your Mac apps using Applescripts

Outlook for Mac Scripts

Scripts are free unless noted with $

Batch Change Events Status


Create Event from Message
Contacts
Delete Outbox Messages
Standardize Contacts & Duplicate Contacts - more info
Edit Subject
FileMessagesByYear
Growl New Mail
MoveToSubFolder
Move Messages to Archive folder
Nuke Messages
Open Progress Window at launch - More info
Remove Duplicate Contacts
Remove Duplicates Messages
Show Message Path
SpamSieve $

Other resources for Outlook Scripts

Justin Lancy’s Outlook Scripts http://veritrope.com/

http://www.scriptsformac.com/script-download-index/outlook-for-mac-scripts/ Page 1 of 41
Outlook for Mac Scripts | A Resource for using Scripts in OS X 10/2/13 10:05 PM

Outlook 2011 to OmniFocus


Outlook 2011 to Evernote
NetNewsWire to Microsoft Outlook (‘Mail Contents’)

93 THOUGHTS ON “OUTLOOK FOR MAC SCRIPTS”

Pirate of pixels
on August 1, 2012 at 6:25 AM said:

Well done!
Removing duplicated contacts worked perfectly, the duplicate email took
awhile. Be sure to run in small batches. Microsoft apps always freeze if
you ask them to do something that should be built in.

Thanks.

Jaco
on August 6, 2012 at 9:22 AM said:

Does anyone have an idea how to remove the “date received” field lookup
from this script? I have the script running but i noticed that my duplicate
emails have different received dates – which means the duplicates are not
being removed.

admin
on August 6, 2012 at 1:54 PM said:

The received can vary. If you import messages the date received
would be the date you imported not actually received originally.
The Date Sent never changes.

Jaco
on August 6, 2012 at 3:27 PM said:

http://www.scriptsformac.com/script-download-index/outlook-for-mac-scripts/ Page 2 of 41
Outlook for Mac Scripts | A Resource for using Scripts in OS X 10/2/13 10:05 PM

So is there then a way to exclude “date received” from the


duplicates email script? I tried the script with only 10
emails in a folder, 4 of which are duplicate, and because
the date received date is different the script didn’t pick up
any duplicates.

Thanks

admin
on August 6, 2012 at 5:13 PM said:

Which remove duplicates script? If you open the


script in the Script Editor you can see the author.

Jaco
on August 6, 2012 at 7:28 PM said:

It is the script from the list above: “Barry Wainwright, 15th October 2010″

martin
on August 16, 2012 at 11:19 PM said:

I get an error in Outlook 14.2.3 the states “Microsoft Outlook got an error:
Can’t get <> of incoming message id 99794″.
Would really appreciate some assistance or insight into what is causing
this.

admin
on November 26, 2012 at 12:51 PM said:

http://www.scriptsformac.com/script-download-index/outlook-for-mac-scripts/ Page 3 of 41
Outlook for Mac Scripts | A Resource for using Scripts in OS X 10/2/13 10:05 PM

Each message is given an ID. It appears there is some corruption


in the message. Sorry this is late. I just received.

Jesse Moon
on August 29, 2012 at 12:18 AM said:

Thanks for the Remove Duplicates Messages, but it was a little bit slow.
Looking forward a faster version. ^^

Appreciate your work!!! Thanks so much!!!

Jesse Moon

admin
on November 26, 2012 at 12:50 PM said:

I agree, it’s very slow. I’m not sure if this is something that can im‐
proved.

Littlemt
on November 26, 2012 at 8:43 AM said:

I installed the script to remove duplicate emails and it had been working
great until I allowed the latest system update. I am back to receiving two
of everything. Is there anyway that I can fix this again. Thanks so much for
your help.

admin
on November 26, 2012 at 12:49 PM said:

I’m assuming you have a POP account and have “leave on server”

http://www.scriptsformac.com/script-download-index/outlook-for-mac-scripts/ Page 4 of 41
Outlook for Mac Scripts | A Resource for using Scripts in OS X 10/2/13 10:05 PM

set. If your email client losses the message IDs that have been
downloaded it will download all messages left on the server that
are in the Inbox. You can log into your account with your browser
and move older messages out of the Inbox to a subfolder. They
will be safely backed up online but won’t be downloaded again un‐
til you move them back to the Inbox.

Your best option is to move from POP to IMAP and you’ll never
have this problem again.

Tom Tuson
on December 27, 2012 at 9:18 AM said:

Your script for removing duplicate emails is a life saver for me. For what
ever reason Outlook 2011 for Mac doesn’t like Gmail’s IMAP or Pop3. I
will have the same email downloaded as high as 4 or 5 times even when it
has been deleted in the Gmail Account though the browser or other
device such as an Android Tablet.

Is there a way to donate to you?

Thanks,
Tom Tuson

admin
on December 27, 2012 at 2:13 PM said:

Gmail is a bit tricky to setup. See my tutorial. It’s possible a setting


is causing what you see as duplicates. (It’s the settings for Labels)

Connect Outlook for Mac 2011 to Gmail’s IMAP service

For Gmail IMAP, I’ve had success using ThunderBird to remove


the duplicates. I would need to refresh my memory on how to do
this since it’s been a while, but let me know if you need help using
TB.

http://www.scriptsformac.com/script-download-index/outlook-for-mac-scripts/ Page 5 of 41
Outlook for Mac Scripts | A Resource for using Scripts in OS X 10/2/13 10:05 PM

I appreciate donations. See my private message with details.

Alex
on February 7, 2013 at 3:37 PM said:

Duplicate script isn’t only doing the selected email. I selected about 50
messages, then it audibly says “checking folder, inbox” “message count
15243″.

It looks like it is removing some but I can’t tell because naturally going
through 15k emails will take forever, but the item count in the folder is now
less 3 so far.

Beat
on February 8, 2013 at 3:45 PM said:

Hi

My Outlook 2011 Mac has over 15000 Emails form MacMail forth and
back and restores and i-dont-know-what-else-more!

I run the script a first test folder (1100 Mails) and the script removed 100%
of all duplicates!
It is a bit slow – BUT 100 times faster than me – cleaning 15000 emails by

hand (or not at all

So this script really rules!!!


I could’t find anything else useful for this problem on the web.
BIG THANKS FOR MAKING AND SHARING THIS SCRIPT!!!!

Beat

http://www.scriptsformac.com/script-download-index/outlook-for-mac-scripts/ Page 6 of 41
Outlook for Mac Scripts | A Resource for using Scripts in OS X 10/2/13 10:05 PM

admin
on February 8, 2013 at 3:52 PM said:

The author is Barry Wainwright. He is looking into ways to make


the script faster. I’ll let him know how much you appreciate the
script.

zo
on February 14, 2013 at 8:03 AM said:

Hi, thank you so much for the scripts!

I ran the Duplicate Message script on a folder with 119,000 emails and it’s
been going for the last 3 days without an indication as to how much
longer it may need. Outlook 2011 (updated to latest patches as of writing)
is ‘not responding’ but I can hear the HD furiously crunching data since I
started.

Is there any way (from your experience) to know how long this may
possibly take? In the future it’d be nice if 100% of processor could be
used to get through all this faster (if that may be a remedy of course).

Thanks again though!

admin
on February 14, 2013 at 8:42 AM said:

Wow! that’s a lot of messages. AFAIK there is no way to estimate


the time. I suspect it would have been better to sort by sent date
then run on smaller batches. I will pass on your comments to the
author to see if there can be improvements added in the future.

I ran it once on approx 3K message and it took around 5 hrs. This


script ran much faster in Entourage. Scripting in Outlook has not
been as robust.

http://www.scriptsformac.com/script-download-index/outlook-for-mac-scripts/ Page 7 of 41
Outlook for Mac Scripts | A Resource for using Scripts in OS X 10/2/13 10:05 PM

zo
on February 15, 2013 at 10:36 AM said:

Hi,

So after 4 days Outlook finally crashed and was back to


square 1.

So I made subfolders and experimented a bit.


3000 mails took almost 2 hours
BUT as soon as it hit less than 1000 it goes MUCH faster.

I made another subfolder with 999 mails and it took 6 min‐


utes

Please pass this info on to the author, this is really strange.

admin
on February 15, 2013 at 3:54 PM said:

I’ve passed on your comments to the author. I’m


sure other users will appreciate your feedback as
well.

fcb
on June 25, 2013 at 6:22 PM said:

Great advice, thanks. making subfolders with only


999 files makes the script A LOT faster. For me it
takes in average 1-2 mins to clean the files with the
script.

http://www.scriptsformac.com/script-download-index/outlook-for-mac-scripts/ Page 8 of 41
Outlook for Mac Scripts | A Resource for using Scripts in OS X 10/2/13 10:05 PM

admin
on February 14, 2013 at 12:19 PM said:

Forgot to mention this before, but having more than 2GB of data
in a folder is not advised. If you try to export as .olm or .mbox it will
fail to export. Rebuilding is much more difficult as well.

Beat
on February 14, 2013 at 12:06 PM said:

On my MacPro Dual Xeon 3 GHz with 16 GB RAM,

Hello

He is my experience with the script:

First thanks, thanks, tanks to the author !!!!!!


Checking of about 6500 Emails takes 16-24s hours!
Time is raising exponentially (2000 Mails 6 Hours)
So may be you make smaller chunks to check 5000 Mails each folder or
so.

When alll partial folders are done (yes long, but less then by hand and
you have a lot less emails, drop all the cleaned mails in one folder an do a
final check on those.

It took me 5 days for my 32000 Mails. But it was well worth it. I do not
care how long it takes at all. I am happy that there IS a way to do it.
Now they are cleared and I have a clean backup and will rarely have to do
the job again for so much mails.

my cents
cheers,
Beat

http://www.scriptsformac.com/script-download-index/outlook-for-mac-scripts/ Page 9 of 41
Outlook for Mac Scripts | A Resource for using Scripts in OS X 10/2/13 10:05 PM

zo
on February 19, 2013 at 6:36 AM said:

Hi! Any update about speeding up the ‘duplicate email’ script?

If anything, would it be possible to create a new script that would allow


the user to “delete duplicates from selected” so that I don’t have to move
1000 emails at a time?

Thanks a ton

admin
on February 19, 2013 at 7:20 AM said:

I can pass this on to the author, but no folder should have over 2K
messages that’s between 6-10,000 messages depending on at‐
tachments. Too many messages in a folder can cause database
rebuild to fail and failure to export as either .olm or .mbox files.

Joe
on February 28, 2013 at 5:05 PM said:

Hi,

I am using another script to archive the messages in the inbox to a folder


under “on my computer” I am doing a copy instead of a move since the
users also have PC’s and moving the messages would prevent them from
seeing them on the PC. So, to the question. How could I incorporate the
duplicate message remover script into the archive script such that if a
message already exists in the destination, don’t copy it?

admin
on February 28, 2013 at 5:58 PM said:

http://www.scriptsformac.com/script-download-index/outlook-for-mac-scripts/ Page 10 of 41
Outlook for Mac Scripts | A Resource for using Scripts in OS X 10/2/13 10:05 PM

AFAIK this is not possible. Your best option would be to move


messages by time. Moving a folder that has ended would ensure
there would be no duplicates.

Remember that any data stored under “On My Computer”is sub‐


ject to data loss. If the Identity fails to rebuild, those messages
would be lost if you did not also export as .olm or .mbox file as
backup.

Jason
on March 6, 2013 at 10:42 AM said:

I can’t figure out how to get the duplicate emails script to work. I have
Outlook 2011 for mac. First of all, the “Outlook Script Menu Items” folder
was not where expected. It was in Applications>Microsoft Office
2011>Office>Office First Run>MUD. I copied the script into the folder, but
I do not know where to run it from within Outlook. Please advise. Thank
you.

admin
on March 6, 2013 at 10:55 AM said:

Applications is not the correct location. Previously the Script Menu


Items folder was in the Microsoft User Data folder in Documents.
However this folder along with other folders were moved to this lo‐
cation in SP2:

~/Library/Application Support/Microsoft/Office

In Mac OS 10.7 & 10.8, the Library folder is hidden. To access the
Library folder:

How to enable the User’s Library folder

For more info on the folders that were moved see this link

http://www.scriptsformac.com/script-download-index/outlook-for-mac-scripts/ Page 11 of 41
Outlook for Mac Scripts | A Resource for using Scripts in OS X 10/2/13 10:05 PM

When the script is in the correct location, to run select it from the
Script icon in the Menu bar. Be sure to read the comments on
number of messages in a folder so the script runs in a timely man‐
ner.

Jason
on March 6, 2013 at 11:49 AM said:

Thank you. The script now appears in outlook. I am still


having a problem though. It does not recognize my dupli‐
cates because they are from an old backup file and some‐
thing must have changed. The obvious attributes are iden‐
tical (subject, sender, send time, etc.) but it does not rec‐
ognize them as duplicates. Is there a way to identify the
duplicates based on just those attributes?

admin
on March 6, 2013 at 11:53 AM said:

Sort the folder by Sent before running the script.

Jason
on March 6, 2013 at 12:50 PM
said:

Sorting doesn’t help.

admin
on March 6, 2013 at 3:05
PM said:

You might try exporting your mail


as .olm file and importing into a
new Identity and try running the
script there. It could be the Outlook
Identity.

http://www.scriptsformac.com/script-download-index/outlook-for-mac-scripts/ Page 12 of 41
Outlook for Mac Scripts | A Resource for using Scripts in OS X 10/2/13 10:05 PM

Murtaza
on March 19, 2013 at 6:45 PM said:

Hi,
Can somebody tell me how to run these scripts. I have downloaded a
script to remove duplicate contacts. But don’t know how to run it.

Thanks in advance.
Regards,
Murtaza

admin
on March 20, 2013 at 7:33 AM said:

While you can run the script by double clicking in the Script Editor,
it’s best to put the script in the Script Menu Items folder.

MSFT moved the Outlook Script Menu folder in SP2 to the Appli‐
cation Support folder in the hidden User’s Library. If you see one in
the Microsoft User Data folder, it’s no longer used.

Select “About this folder” under the Script icon. You can then click
on the button “Open Folder”.
Place the script in this folder.
In Outlook, select the script under the Script icon (next to Help).
Looks like a squiggly S.

Murtaza

http://www.scriptsformac.com/script-download-index/outlook-for-mac-scripts/ Page 13 of 41
Outlook for Mac Scripts | A Resource for using Scripts in OS X 10/2/13 10:05 PM

on March 20, 2013 at 3:22 AM said:

Just double clicked it and it started running. Still running for last five hours.
I had about 5k contacts.
Regards,
Murtaza Khan

admin
on March 20, 2013 at 7:35 AM said:

If you read through the comments you will see the script does not
do well with lots of contacts. One user found that less than 1000
worked.

I suspect it might fail in the end and you’ll need to start over by
creating subfolder with a smaller number. If you sort by Sent, this
will keep the duplicates together.

Murtaza
on March 20, 2013 at 12:00 PM said:

Hi, I am removing the duplicate contacts, therefore,


couldn’t sort by Sent, instead I sorted by Name, which will
keep the duplicates together as well. It deleted 501 dupli‐
cates and gave an error that “Microsoft Outlook got an er‐
ror: Cannot delete this item. number-10003 from contact
id 5075″

I don’t know what this means. Can somebody advise???


Thanks…

admin
on March 20, 2013 at 12:08 PM said:

I’m trying to find how to find ID for you and will get
back.

http://www.scriptsformac.com/script-download-index/outlook-for-mac-scripts/ Page 14 of 41
Outlook for Mac Scripts | A Resource for using Scripts in OS X 10/2/13 10:05 PM

Murtaza
on March 20, 2013 at 1:16 PM
said:

Thanks a lot…

admin
on March 20, 2013 at 2:26 PM said:

Paste the following in the AppleScript Editor (Appli‐


cations/Utilities)

tell application “Microsoft Outlook”


to open (contact id 1)

Substitute your id 5075 for id 1. ID 1 is your “this is


me” contact.

Murtaza
on March 20, 2013 at 3:01 PM
said:

Hi, I did the same and it gave me a syntax


error, “Expected expression, property or
key form, etc. but found unknown token.”

admin
on March 20, 2013 at 3:06
PM said:

When you copy a script you need


to be sure to remove returns. I’ll
send you the script privately.

http://www.scriptsformac.com/script-download-index/outlook-for-mac-scripts/ Page 15 of 41
Outlook for Mac Scripts | A Resource for using Scripts in OS X 10/2/13 10:05 PM

Murtaza
on March 20, 2013
at 5:05 PM said:

Thank you very much. I


tried running if from inside
Outlook and it took less and
a minute to remove 2082
duplicates out of 5K.

Thank you very much.


Best regards,

Murtaza.

Michael
on March 20, 2013 at 8:28 AM said:

Create Event from Message Script creates an event with the date
1/1/1900. Any way to force today’s date for the event?

Michael
on March 20, 2013 at 8:29 AM said:

Create Event from Message creates an event with the date 1/1/1900. Any
way to force Today’s date?

admin

http://www.scriptsformac.com/script-download-index/outlook-for-mac-scripts/ Page 16 of 41
Outlook for Mac Scripts | A Resource for using Scripts in OS X 10/2/13 10:05 PM

on March 20, 2013 at 8:31 AM said:

This is one of the default script supplied by Microsoft. I can ask


some scripters if this could be modified, but trying to get Microsoft
to edit this is most likely futile.

admin
on March 20, 2013 at 12:24 PM said:

I sent you a script to try. Check your email. Let me know if this
works.

Baback Shahriari
on March 24, 2013 at 6:07 PM said:

I noticed the Duplicate message script only works folder by folder. Any
chance I can run the script by multiple folders OR the entire account ? We
have accounts that have upwards of 50-100 folders!

Any help on this would be GREATLY appreciated.

Thank you.

admin
on March 30, 2013 at 10:38 AM said:

No, the script only works on folders plus it works best on 1000
messages or less. Read the comments.

http://www.scriptsformac.com/script-download-index/outlook-for-mac-scripts/ Page 17 of 41
Outlook for Mac Scripts | A Resource for using Scripts in OS X 10/2/13 10:05 PM

Ben Levi
on March 30, 2013 at 10:36 AM said:

I’m in desparate need of the equivalent of the “Split Recipients” script in


Entourage. I changed the obvious language (“Entourage” to “Outlook”) but
it doesn’t work. Can anyone help? Thanks!

admin
on March 30, 2013 at 10:40 AM said:

Join the mailing list “Script Outlook”. Some of the members might
be able to help.

http://host171.hostmonster.com/mailman/listinfo/scriptout‐
look_officeformachelp.com

Ben Levi
on March 31, 2013 at 7:28 AM said:

I sent the Applescript to a person who wrote back the fol‐


lowing:
«class pMsg»: in the old script this is “displayed message”.
I don’t see any equivalent in the Outlook dictionary. Unfor‐
tunately, this seems to be the basis for the script. Perhaps,
this could be exchanged for the first element in the selec‐
tion.

«class addr»: was “address”, should be “email address”

«class rtyp»: was “recipient type”, should be “type”

«class pOtB»: was “outbox folder”, remove “at the «class


pOtB»”

«class pSTy»:«constant eSTyeSNn»: was signature type‐


:none, as far as I remember support of sigs came with a
dot release. I never install those.

http://www.scriptsformac.com/script-download-index/outlook-for-mac-scripts/ Page 18 of 41
Outlook for Mac Scripts | A Resource for using Scripts in OS X 10/2/13 10:05 PM

«class stor»: was storage, perhaps something like “if name


of mail folder of theMsg is “Drafts”"

«class pDrF»: was drafts folder, should be drafts

«class pStM»: was sent items folder, should be sent items

set «class dlvs» of theMsg to «constant Edlvsent»: “set de‐


livery status of theMsg to sent”

«constant Erty!cc »: was cc recipient, this still should exist

«constant Erty!bcc»: was bcc recipient, this still should ex‐


ist

«class cAgM»: was “every group entry of theGroup”,


should be “every member of the group theGroup”
————
FYI, here’s the old Applescript (slightly modified to try to
work with Outlook):
–Split Recipients v2.0
–Paul Berkowitz
–v1.1 Workaround for Entourage bug with file of attach‐
ment, and Unicode, also doesn’t open BCC extras as draft
windows, and has shortcut
–v2.0 works with groups as recipients – splitting them into
separate BCC recipients if “Don’t show addresses”,; also
doesn’t lose Unicode with BCC text
–v2.1 Ben Levi – tried to get it to work with Outlook

property max : 50

global firstCC

tell application “Microsoft Outlook”

if the class of the front window ≠ draft window then


beep 2
display dialog “Split Recipients X script can only run with a
new message window in the front.” & return & return & “(To

http://www.scriptsformac.com/script-download-index/outlook-for-mac-scripts/ Page 19 of 41
Outlook for Mac Scripts | A Resource for using Scripts in OS X 10/2/13 10:05 PM

change the maximum number of recipients, run the \”Split


Recipients PREFS\” script from the script menu.” buttons
{“OK”} default button 1 with icon 0
return –quit

end if

set theWindow to the front window


try
set theMsg to «class pMsg» of theWindow — if a saved
draft already, otherwise ‘save’ closes it and saves as differ‐
ent nmessage if IMAP!
on error
save theWindow
set theMsg to «class pMsg» of theWindow
end try
close theWindow saving yes

set theSubject to the subject of theMsg as Unicode text


set theBody to the content of theMsg as Unicode text
set theAccount to the account of theMsg
set thePriority to the priority of theMsg

set theAttachments to the attachments of theMsg


set theFiles to {}

set temp to (path to temporary items) as Unicode text

repeat with i from 1 to (count theAttachments)


set theAttachment to item i of theAttachments
–set theFile to the file of theAttachment — bug in EvX: re‐
quires workaround:
set attName to name of theAttachment as Unicode text
try — if already there from a previous save, just use that
one
save theAttachment in (temp & attName)
end try
tell me to set theFile to alias (temp & attName) — needs
the ‘tell me’ for some reason
set the end of theFiles to theFile

http://www.scriptsformac.com/script-download-index/outlook-for-mac-scripts/ Page 20 of 41
Outlook for Mac Scripts | A Resource for using Scripts in OS X 10/2/13 10:05 PM

end repeat
set newAttachments to {}
repeat with aFile in theFiles
set end of newAttachments to {file:aFile}
end repeat

set theRecipients to every recipient of theMsg


set newRecipientList to {}
set fullListing to {}
set newBCCRecipients to {}
set firstCC to “yes” — global

repeat with theRecipient in theRecipients

set theAddress to the «class addr» of theRecipient


set theEAddress to the «class addr» of theAddress
set theName to the display name of theAddress as Uni‐
code text
set thetype to the «class rtyp» of theRecipient

if theEAddress = “” then — group

set {newRecipientList, fullListing, newBCCRecipients} to


my ProcessGroup(theName, thetype, newRecipientList,
fullListing, newBCCRecipients)

else

set {newRecipientList, fullListing, newBCCRecipients} to


my ProcessRecipient(theEAddress, theName, thetype,
newRecipientList, fullListing, newBCCRecipients)

end if

end repeat

repeat while newRecipientList ≠ {}

if (count of newRecipientList) > max then


set groupRecipientList to (items 1 thru max of newRecipi‐

http://www.scriptsformac.com/script-download-index/outlook-for-mac-scripts/ Page 21 of 41
Outlook for Mac Scripts | A Resource for using Scripts in OS X 10/2/13 10:05 PM

entList)
set newRecipientList to (items (max + 1) thru -1 of newRe‐
cipientList)

set otherRecipients to (items (max + 1) thru -1 of fullListing)


set fullListing to otherRecipients & (items 1 thru max of full‐
Listing)
else
set groupRecipientList to newRecipientList
set newRecipientList to {}

if (count of fullListing) > max then


set n to count of groupRecipientList
set otherRecipients to (items (n + 1) thru -1 of fullListing)
set fullListing to otherRecipients & (items 1 thru n of fullList‐
ing) — put full Listing back to original order
else — if running this script when the total number of to
(and cc) recipients is LESS than the maximum allowed
set otherRecipients to {}
end if
end if

set AppleScript’s text item delimiters to return


set otherRecipients to otherRecipients as Unicode text
set AppleScript’s text item delimiters to “”

if otherRecipients ≠ “” then — if total number of recipients


is greater than max allowed, others in other emails
set theNewBody to ((“<<<< In addition to the above recipi‐
ents, this message was also sent to: " & return) as Unicode
text) & otherRecipients & return & return & return & the‐
Body

else — just send the message to the recipients


set theNewBody to theBody
end if

if theFiles ≠ {} then — if there is any attachment

make new outgoing message at the «class pOtB» with

http://www.scriptsformac.com/script-download-index/outlook-for-mac-scripts/ Page 22 of 41
Outlook for Mac Scripts | A Resource for using Scripts in OS X 10/2/13 10:05 PM

properties {account:theAccount, subject:theSubject, con‐


tent:theNewBody, priority:thePriority, attachment:newAt‐
tachments, recipient:groupRecipientList}

else

make new outgoing message at the «class pOtB» with


properties {account:theAccount, subject:theSubject, con‐
tent:theNewBody, priority:thePriority, recipient:groupRecip‐
ientList}

end if

end repeat

if newBCCRecipients ≠ {} then

set AppleScript's text item delimiters to return


set fullListing to fullListing as Unicode text
set AppleScript's text item delimiters to ""

if fullListing ≠ "" then


set theBCCBody to ("<<< max then
set groupBCCRecipientList to (items 1 thru max of new‐
BCCRecipients)
set newBCCRecipients to (items (max + 1) thru -1 of new‐
BCCRecipients)

else
set groupBCCRecipientList to newBCCRecipients
set newBCCRecipients to {}
end if

if theFiles ≠ {} then — if there is any attachment

make new outgoing message at the «class pOtB» with


properties {account:theAccount, subject:theSubject, con‐
tent:theBCCBody, «class pSTy»:«constant eSTyeSNn», pri‐
ority:thePriority, attachment:newAttachments, recipient:‐
groupBCCRecipientList}

http://www.scriptsformac.com/script-download-index/outlook-for-mac-scripts/ Page 23 of 41
Outlook for Mac Scripts | A Resource for using Scripts in OS X 10/2/13 10:05 PM

else

make new outgoing message at the «class pOtB» with


properties {account:theAccount, subject:theSubject, con‐
tent:theBCCBody, «class pSTy»:«constant eSTyeSNn», pri‐
ority:thePriority, recipient:groupBCCRecipientList}

end if

end repeat

if «class stor» of theMsg is «class pDrF» then — not if you


have an IMAP drafts folder on server, won’t work
move theMsg to «class pStM»
end if

set «class dlvs» of theMsg to «constant Edlvsent»

send — sends out all messages in Outbox

end tell

on ProcessRecipient(theEAddress, theName, thetype,


newRecipientList, fullListing, newBCCRecipients)

local recipientText, RecipientReconstructed, BCCRecipien‐


tReconstructed

tell application “Microsoft Outlook”


if theName ≠ “” then
set recipientText to theName & ” ”
else
set recipientText to “”
end if

if thetype = «constant Erty!cc » and firstCC = “yes” then


set recipientText to (return & “CC: ” & recipientText) as Uni‐
code text
set firstCC to “no”
end if

http://www.scriptsformac.com/script-download-index/outlook-for-mac-scripts/ Page 24 of 41
Outlook for Mac Scripts | A Resource for using Scripts in OS X 10/2/13 10:05 PM

if thetype ≠ «constant Erty!bcc» then


set RecipientReconstructed to {«class addr»:{«class
addr»:theEAddress, display name:theName}, «class
rtyp»:thetype}
set end of newRecipientList to RecipientReconstructed

set end of fullListing to recipientText

else
set BCCRecipientReconstructed to {«class addr»:{«class
addr»:theEAddress, display name:theName}, «class
rtyp»:«constant Erty!bcc»}
set end of newBCCRecipients to BCCRecipientRecon‐
structed
end if

end tell

return {newRecipientList, fullListing, newBCCRecipients}

end ProcessRecipient

on ProcessGroup(theName, thetype, newRecipientList, ful‐


lListing, newBCCRecipients)

local theGroup, memberType, memberAddress, member‐


Name

tell application “Microsoft Outlook”


try
set theGroup to first group whose name = theName —
avoid ‘contact’ error in Entouarge X if same name
on error
beep 2
display dialog “You have included an invalid recipient – \”"
& theName & “\” – with no email address, and which is not
a group, either.” & return & return & “Remove or fix this re‐
cipient, then try again.” buttons {“Cancel”} default button 1
with icon 0
error number -128

http://www.scriptsformac.com/script-download-index/outlook-for-mac-scripts/ Page 25 of 41
Outlook for Mac Scripts | A Resource for using Scripts in OS X 10/2/13 10:05 PM

end try

if suppress member names of theGroup then


set memberType to «constant Erty!bcc»
else
set memberType to thetype
end if
set groupPropsList to content of every «class cAgM» of
theGroup
repeat with j from 1 to (count groupPropsList)
set {memberAddress, memberName} to {«class addr», dis‐
play name} of item j of groupPropsList
if memberAddress = “” then — group within group
set {newRecipientList, fullListing, newBCCRecipients} to
my ProcessGroup(memberName, memberType, newRe‐
cipientList, fullListing, newBCCRecipients) — recursive
else
set {newRecipientList, fullListing, newBCCRecipients} to
my ProcessRecipient(memberAddress, memberName,
memberType, newRecipientList, fullListing, newBCCRecip‐
ients)
end if
end repeat
end tell

return {newRecipientList, fullListing, newBCCRecipients}

end ProcessGroup
—————–
If you could shed any light as to whether or not it is possi‐
ble to modify the original so it would work with Outlook, I
would very much appreciate it, as would many others, I
think, who found this script so useful in Entourage.
Thank you.

http://www.scriptsformac.com/script-download-index/outlook-for-mac-scripts/ Page 26 of 41
Outlook for Mac Scripts | A Resource for using Scripts in OS X 10/2/13 10:05 PM

Alfredo Dominguez
on April 5, 2013 at 1:57 PM said:

I tried the Remove Duplicate Messages script on Outlook for Mac 2011 on
just two files (within my sent folder) and get an endless beach ball which
invariably leads me to Force Quit the app. Any tips?

Thank you…

PS I installed the script through the Library folder not the scripts folder
within Documents

admin
on April 5, 2013 at 5:07 PM said:

If you have an Outlook Scripts Menu Items folder in the Microsoft


User Data folder in Documents, you can delete it and several other
folders. When Microsoft moved the folder to your User’s Library,
they failed to removed the old ones.

Are you selecting the script from the Script icon in the Menu bar
next to Help? It’s best run on a folder with less than 1000 mes‐
sages. If you want to test, I would create a folder and drag a few
test messages into the folder to run. The removed duplicates go to
the Deleted Items folder. I suggest emptying it first so you’ll know
what gets removed.

Alfredo Dominguez
on April 8, 2013 at 1:46 PM said:

Wow! It worked!

I did as you suggested, and created a new folder where I


moved 74 items. It brought it down to 38! This is fantastic.
Thank you!

This is a major accomplishment for me because I have a


very large Outlook database (30GB+). It ballooned even

http://www.scriptsformac.com/script-download-index/outlook-for-mac-scripts/ Page 27 of 41
Outlook for Mac Scripts | A Resource for using Scripts in OS X 10/2/13 10:05 PM

more when I signed up with Microsoft Exchange as it’s


holding duplicate sent emails from POP based emails.

Now the trick is to go through the other 44,000 sent emails


from 2012 and 2013… It looks like I should create a temp
folder and move them 1,000 at a time. Suggestions wel‐
come.

I wrote in this forum initially with skeptical about a re‐


sponse or whether it would work…

Thank you VERY MUCH again. Also, please advise how to


donate.

Alfredo Dominguez
on April 8, 2013 at 2:28 PM said:

PS: although it is removing duplicates, it seems to


be skipping some. I can’t figure out why…

admin
on April 8, 2013 at 2:41 PM said:

Thanks for your offer to donate. Much appreciated.


Paypal account: diane@needhelp4mac.com

Glad the script is working for you now.

admin
on April 8, 2013 at 2:43 PM said:

It could be a slight difference in date sent


that is causing this. For example if you
downloaded then at a later date it down‐
loaded again with a different time stamp.

http://www.scriptsformac.com/script-download-index/outlook-for-mac-scripts/ Page 28 of 41
Outlook for Mac Scripts | A Resource for using Scripts in OS X 10/2/13 10:05 PM

Alfredo Dominguez
on April 9, 2013 at 5:45 AM
said:

Part of the reason my outlook is


creating duplicates is because I use
Exchange with one of my 7 email
accounts. The other 6 are still on
Outlook as POP. I have a rule to
auto bcc myself from POP sent
emails so that a copy of them can
be stored in my Exchange sent
folder. So most of these duplicates
are received relatively instantly (Not
sure if the script is removing based
on sent vs received date – that
could make a big difference). It is
cleaning up duplicates indeed, just
not all.

I also gave it a shot at cleaning


3,000 emails by leaving it working
overnight but this morning I re‐
turned to see a “Script error: Ap‐
pleEvent timed out”. I’m back to
setting up a temp folder with
<1,000 but have around 70,000
emails to go since 2011.

admin
on April 9, 2013 at
8:10 AM said:

Let’s be clear… Are you


looking in a “unified view” to
see the duplicates? The
Copy should by default land
in your Exchange Inbox, but
the POP Sent should be in

http://www.scriptsformac.com/script-download-index/outlook-for-mac-scripts/ Page 29 of 41
Outlook for Mac Scripts | A Resource for using Scripts in OS X 10/2/13 10:05 PM

the “On My Computer” Sent


folder.

I think a rule to move those


messages received by Ex‐
change would be a better
way to deal with the cc you
are sending to yourself.

Try a rule with From > Is Me

Move message to folder


“Sent from POP”

You might need to tweak


this a bit but it’s a start.

Alfredo Dominguez
on April 9, 2013 at 7:20 AM said:

Sent from an earthlink address

admin
on April 9, 2013 at 8:11 AM
said:

Thank you very much. It’s nice to


be appreciated.

http://www.scriptsformac.com/script-download-index/outlook-for-mac-scripts/ Page 30 of 41
Outlook for Mac Scripts | A Resource for using Scripts in OS X 10/2/13 10:05 PM

wayne
on April 13, 2013 at 1:09 AM said:

Hi, any youtube video can teach me how to use after having downloading
the script?
I have followed every step below but still can’t.

While you can run the script by double clicking in the Script Editor, it’s
best to put the script in the Script Menu Items folder.

MSFT moved the Outlook Script Menu folder in SP2 to the Application
Support folder in the hidden User’s Library. If you see one in the Microsoft
User Data folder, it’s no longer used.

Select “About this folder” under the Script icon. You can then click on the
button “Open Folder”.
Place the script in this folder.
In Outlook, select the script under the Script icon (next to Help). Looks like
a squiggly S.

admin
on April 13, 2013 at 1:48 PM said:

Select the folder in Outlook THEN select the script. The script runs
on the folder you selected.

Steve L
on April 13, 2013 at 5:44 AM said:

Please could you tell me how to select different folders in Outlook 2011 for
Mac, using the script. Wasn’t clear in the read me text document.

Thanks

http://www.scriptsformac.com/script-download-index/outlook-for-mac-scripts/ Page 31 of 41
Outlook for Mac Scripts | A Resource for using Scripts in OS X 10/2/13 10:05 PM

Curt
on April 20, 2013 at 4:41 AM said:

Outlook causes me an incredible amount of grief. It caused me tons of


grief on Windows and now it’s doing the same on Mac.

In the middle of writing a message, Outlook for Mac 14.1.0 shut down as
it does once in a while. It rebuilt the identity. When it finished, I have 15
“Recovered Folder”s. Some of them had messages that were both non-
duplicates and duplicates of the messages in the Inbox and Sent folder.

I tried to use your script to delete duplicate messages. I moved some of


the messages from one of the Recovered Folder to the Sent folder and
ran your script on the Sent folder. Since, I have approximately 8,000
messages, it seemed to take forever.

Consequently, I moved the messages from one of the Recovered Folders


to a temp folder and moved the messages from the Sent folder that
corresponded to the same time period. With approx. 2,000 messages in
the temp folder, I ran the script. It still took several hours overnight and in
the morning, I got a message stating that Applescript timed out. It had
moved 453 messages to the Delete folder, but many of those messages
were not-duplicates. It will take a long to time manually to figure out which
ones in the Delete folder are duplicates and which ones are not, so I think
I’m forced to move them all into the Sent folder.

I’ve now spent over 5 hours on this mess.

What am I doing wrong? What should I do, other than ditch Outlook?

admin
on April 20, 2013 at 9:51 AM said:

Look for my personal reply. Your troubleshooting issues are sepa‐


rate from using this script and need to be addressed first. The
script runs best on 1000 messages or less.

http://www.scriptsformac.com/script-download-index/outlook-for-mac-scripts/ Page 32 of 41
Outlook for Mac Scripts | A Resource for using Scripts in OS X 10/2/13 10:05 PM

Curt
on April 20, 2013 at 4:48 AM said:

Here’s another problem.

Some of the duplicates messages are associated with my IMAP account.


One duplicate message has the content downloaded. The other duplicate
message tries to download the content from IMAP but gets no response.
After running the script, the duplicate messages that has the content are
put into the Delete folder. The duplicate messages that cannot download
the content are left in the temp folder. I want the reverse. How can I get
the script to do the reverse?

admin
on April 20, 2013 at 9:40 AM said:

I’m sorry but the script does not compare message content.
You’re going to have to do this manually.

Michelle
on April 25, 2013 at 6:33 AM said:

The script is doing a wonderful job of removing duplicates – thank you!


Unfortunately, in my situation it is removing the set that shows that I have
replied to emails etc. Last night outlook decided to duplicate about 600 of
my past emails in my inbox. Of course I had already replied to or
forwarded many of these emails. I would like the newly duplicated emails
to be removed rather than the ones that indicate that I’ve sent a reply – is
there something I can change in the script to have it make it delete the
opposite duplicate from what it is deleting now? It is consistently removing
the older message that shows a reply.

http://www.scriptsformac.com/script-download-index/outlook-for-mac-scripts/ Page 33 of 41
Outlook for Mac Scripts | A Resource for using Scripts in OS X 10/2/13 10:05 PM

Thank you so much for any help you can provide!

admin
on April 29, 2013 at 12:15 AM said:

Sorry but that is not possible. If you switched to IMAP from POP
you wouldn’t get the duplicates.

cs
on May 9, 2013 at 8:42 AM said:

Just installed the 14.3.4 update for outlook 20111 mac and this greatly
improves the speed of this script. Thanks for the great script!

Max
on June 18, 2013 at 5:23 AM said:

Gmail has created thousands of duplicate sent emails. Before Mtn Lion I
used a script that deleted all the duplicates. It no longer works under Mtn
Liion (and I am using Apple Mail). So I’m hoping this nifty script will delete
the duplicates from my Mac Office 2011 Outlook “Sent Items” folder.

But I can’t find the folder to install the script. If I double click on the script
it starts running but not sure which folder it’s checking. Any help
appreciated!
Thanks

admin
on June 18, 2013 at 12:29 PM said:

Most likely the duplicate sent items is a result of incorrect settings


in your Gmail account. Open your Gmail account. Click on Ad‐

http://www.scriptsformac.com/script-download-index/outlook-for-mac-scripts/ Page 34 of 41
Outlook for Mac Scripts | A Resource for using Scripts in OS X 10/2/13 10:05 PM

vanced. Select Folders. Select “Don’t store a copy of sent mes‐


sages”. By default Gmail creates a sent message when sending
from your account. See this article for more info on setting up you
account. Connect Outlook for Mac 2011 to Gmail’s IMAP service

The Apple script will not work with Outlook. The Outlook remove
duplicate script only works on up to 1000 messages at a time.
You might be better off correcting your settings then delete the
gmail account and all the emails downloaded into Outlook and let
it sync back to the server. The dupes should only be in Outlook
and not on the server.

To install Outlook scripts, click on the Script icon (squiggly S to the


right of Help) and select “About this menu”. Click on the Open
Folder button to open the Script Menu Items folder. Put the script
in this folder. Select the script from the Menu bar to run.

Seo Andy
on July 12, 2013 at 1:38 PM said:

First of all thank you for this great free script to delete my duplicate emails
from my outlook for mac 2011. The only problem what i have, i get the
error message (i use a german version) “Microsoft outlook have got an
error “every message of mail folder id 121″ don´t understand the message
“count”

What is meaning that?


And how can i fix that?

Thank you so much!

best regards

André

admin

http://www.scriptsformac.com/script-download-index/outlook-for-mac-scripts/ Page 35 of 41
Outlook for Mac Scripts | A Resource for using Scripts in OS X 10/2/13 10:05 PM

on July 12, 2013 at 3:20 PM said:

Are you selecting messages in a single folder? Don’t use on a fold‐


er with more than 1,000 messages per folder. Subdivide into
smaller folders to run script.

SeoPro24.com Andy
on July 13, 2013 at 1:31 AM said:

Yes, indeed. I selected one folder (without selecting all


messages. And the folder include more than 2000 mes‐
sages and the other folder have more than 6000 message,
also the other more than 4000 messages. So it doesn´t
matter wich folder i select and run the script, i get every
time the mentioned error

When i do what you wrote “Subdivide into smaller folders


to run script.” how can i know that that the one double
message is not included in the other folder?

best regards

André

admin
on July 13, 2013 at 12:00 PM said:

Sort by date so that all messages in a single date


are included.

SeoPro24.com Andy
on July 13, 2013 at 1:33 AM said:

PS: When i tried it with 255 emails i received exact the


same error, check the screen please.

http://www.scriptsformac.com/script-download-index/outlook-for-mac-scripts/ Page 36 of 41
Outlook for Mac Scripts | A Resource for using Scripts in OS X 10/2/13 10:05 PM

https://www.evernote.com/shard/s248/sh/93cd67ea-
4790-4250-824c-36551b8a1f1f/19e‐
f60659c321583842b14f5a57e3767

Thank you very much for your help!

admin
on July 13, 2013 at 12:02 PM said:

I have contacted the author for help. Other than


suggesting you try on a different folder to see if you
see the same error, it’s possible it’s corruption in
your Identity that is causing the problem. If you as‐
sign a category to all items in that folder then File >
Export by category > “select category you as‐
signed”, you can import that .olm file into a new
Identity and test there.

Tyrone
on July 22, 2013 at 8:53 AM said:

Hi there,

Firstly thanks for the resource library!

Then, I encountered an interesting problem with the Outlook Duplicate


Remover script…

I have a folder with 1480 emails of which approximately half seem to be


duplicates. When I ran the script, it removed 930 emails which seemed a
little too many for me. On closer inspection, I realised it had remove some
duplicates but left others and, in other cases, it had remove the duplicate
and the duplicated email.

http://www.scriptsformac.com/script-download-index/outlook-for-mac-scripts/ Page 37 of 41
Outlook for Mac Scripts | A Resource for using Scripts in OS X 10/2/13 10:05 PM

I then tested this in a folder I created with 4 emails into it – 2 emails each
duplicated. I’l call them as follows:
1. A
2. A’s duplicate
3. B
4. B’s duplicate

When I ran the script on this folder it correctly detected 4 emails and then
correctly said it removed 2 duplicates. But instead of removing items 2
and 4, it removed 3 and 4, leaving A and its duplicate…

Any ideas what could lead to this?

Thanks,
Tyrone

admin
on July 22, 2013 at 9:31 AM said:

The comments are full of not using this script on a folder with more
than 1000 messages.

The script checks by date sent not by date added. Other than
checking headers to see dates, I can’t say why you got the results
you did. I’m not the author. I just post the scripts.

Abhi
on September 1, 2013 at 11:03 PM said:

Hi,

I want to create a drop down button to list all the alternative Email
accounts in Mac Outlook 2011, Can we do this using Mac Scripts?

admin

http://www.scriptsformac.com/script-download-index/outlook-for-mac-scripts/ Page 38 of 41
Outlook for Mac Scripts | A Resource for using Scripts in OS X 10/2/13 10:05 PM

on September 2, 2013 at 11:16 AM said:

For help creating a script you would need to ask on the Outlook
forum. Otherwise see if this option will work for you needs..

http://www.officeformachelp.com/2013/08/unleash-new-uses-for-
keyboard-commands-in-outlook-for-mac/#ChangeTheSendingE‐
mailAccount

WF
on September 8, 2013 at 8:45 PM said:

Hello, any suggestions for the Outlook Duplicate Email “Remove


Duplicates v2.1
Script? the script gave the error: error “Microsoft Outlook got an error:
AppleEvent timed out.” number -1712

Looking forward to any feedback and suggestions on how to move


forward with this script, or other similar solutions for a Mac running
Outlook 2011. Thank you.

admin
on September 11, 2013 at 12:38 PM said:

Sounds like too many messages in folder. See other comments


about this. No more than 1000 messages in folder when you run
the script.

Crazy Craig
on September 11, 2013 at 10:30 AM said:

I found a script that creates events from email messages, and another

http://www.scriptsformac.com/script-download-index/outlook-for-mac-scripts/ Page 39 of 41
Outlook for Mac Scripts | A Resource for using Scripts in OS X 10/2/13 10:05 PM

script that creates a task from an email message. What i am now looking
for is a script for creating an event from a task. Any ideas?

admin
on September 11, 2013 at 12:37 PM said:

In Outlook, select the event, Control-Click (Right-click) on event.


Select Follow Up.

This allows you to set a time.

Gabriel
on September 23, 2013 at 8:00 AM said:

I get the following error when executing the script in Outlook to edit a
subject:

Microsoft Outlook got an error: “Subject:” doesn’t understand the


message <>

Any clues?

Yahathei
on September 24, 2013 at 9:15 AM said:

Love the scripts. But…..


When running the “Remove Duplicate Contacts” script from the Outlook
script menu I get this message: “Script Error: Microsoft Outlook got an
error: Cannot delete this item.”

I am running Outlook 14.3.7 and have 1301 contacts. It would be nice if


there were some indication of exactly which “item” has the problem, I

http://www.scriptsformac.com/script-download-index/outlook-for-mac-scripts/ Page 40 of 41
Outlook for Mac Scripts | A Resource for using Scripts in OS X 10/2/13 10:05 PM

could then manually delete that item/items. After the message no items
are deleted. Got any suggestions?

admin
on September 24, 2013 at 12:30 PM said:

No one else has ever reported this particular issue so not sure
what could be done with the script.

You could try exporting your contacts as .olm file and import into a
new test Identity then run the script. Sometimes the export/import
process will “wash” corruption. If that works, delete the contacts in
your Main Identity and import the cleaned contacts back.

If you can get the data into Apple Contacts it has a remove dupli‐
cates feature. However syncing data is iffy between Apple and
Outlook. More info:

Confused over what syncs in Outlook 2011?

http://www.scriptsformac.com/script-download-index/outlook-for-mac-scripts/ Page 41 of 41

You might also like