Skip to content

Instantly share code, notes, and snippets.

@papoms
Created December 9, 2013 08:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save papoms/7869222 to your computer and use it in GitHub Desktop.
Save papoms/7869222 to your computer and use it in GitHub Desktop.
Outlook mac 2011 - Move to folder Shortcut Action (Automator Workflow)
(*
Original code from http://forgetmenotes.blogspot.com/2011/01/mac-outlook-2011-keyboard-shortcut-to.html
Adapted 2013 by Paul Porzky http://porzky.com
*)
on run {}
tell application "Microsoft Outlook"
-- listSelectedItems : a list of all items selected in Entourage
set listMessages to current messages
-- Check to make sure items are selected, if not then quit
if ((count of listMessages) < 1) then return
-- Iterate through selected items
repeat with objInSelection in listMessages
set listFolders to mail folders
repeat with objFolder in listFolders
if (name of objFolder is "follow-up") then
set gtdFolder to objFolder
end if
end repeat
if (class of account of objInSelection is not imap account) then
-- IMAP currently not supported
move objInSelection to gtdFolder
end if
end repeat
end tell
end run
@abraham09
Copy link

I keep getting a "Syntax Error" when trying to compile: "Expected end of line, etc. but found identifier." Does for lines 11, 19 & 21. The script used to work, not sure why it won't anymore.

@papoms
Copy link
Author

papoms commented Jul 2, 2014

i tried it again on 10.9.3 and it works just as expected. Are you sure you made no mistakes while copy and pasting?
Try downloading the script via http://porzky.com/wp-content/uploads/MovetoFollow-Up.scpt

@stomgb
Copy link

stomgb commented Aug 27, 2014

Also got errors on the script above.

Here's a script that worked for me:

(*
 Original code from https://stackoverflow.com/questions/4413522/how-can-i-improve-this-applescript-macro-for-moving-emails-to-folders-in-office/25536769#25536769
*)


tell application "Microsoft Outlook"

    (* set account *)
    set thisAccount to exchange account "NAME_OF_OUTLOOK_ACCOUNT" -- e.g "Tom", "Work", "Your-Company-Name"
    set thisFolders to mail folder of thisAccount

    (*  find the particular folder I want to put all the messages in.
        the idea in this script is that you might want to move the emails to a subfolder of some root folder.
        in the example below, "Archived" is a subfolder of "Processed email". 
        if "Archived" is not a subfolder then just move the message to "thisRoot" directly (see comments inline)

     *)
    repeat with theFolder in thisFolders
        if name of theFolder is "Processed email" then  -- change name to "Archived" if "Archived" is not a sub folder
            set thisRoot to theFolder
        end if
    end repeat

    set destFolder to folder "Archived" of thisRoot  -- comment this line out if "Archived" is not a sub folder
    set currMsgs to current messages

    (* move all the messages *)

    repeat with theMessage in currMsgs
        move theMessage to destFolder  -- replace with line below if "Archived" is not a sub folder
        -- move theMessage to thisRoot  
    end repeat
end tell

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment