• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: New Recipient in Outlook 2011
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: New Recipient in Outlook 2011


  • Subject: Re: New Recipient in Outlook 2011
  • From: Christopher Stone <email@hidden>
  • Date: Thu, 15 Oct 2015 18:14:55 -0500

On Oct 15, 2015, at 08:25, Dave <email@hidden> wrote:
I’m trying to add a recipient to a draft message in Outlook 2011 using AppleScript. I open the message in the drafts folder and it’s the front window when the following script runs:
______________________________________________________________________

Hey Dave,

OSX 10.11
Microsoft® Outlook® for Mac 2011
Version 14.5.7 (151005)

This script is based on creating a new draft but should work for an existing draft.

A draft DOES NOT have an outgoing message object UNTIL it is saved the first time.

A draft MUST have an object before you can alter it, so the script will save the draft-message if its object equals missing value.

For some reason Outlook does NOT like having a new recipient added via script WHEN the focus is in the To-Field, so if the focus is there the script moves it to the Subject-field.

I dislike all this workaround crap.  These sorts of basic operations should just work.

--
Best Regards,
Chris

-------------------------------------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2015/10/15 17:00
# dMod: 2015/10/15 17:40 
# Appl: Microsoft Outlook, System Events
# Task: Set To-Field of front draft window to email address.
# Tags: @Applescript, @Script, @Microsoft_Outlook, @System_Events
-------------------------------------------------------------------------------------------
tell application "Microsoft Outlook"
  if class of front window ≠ draft window then
    error "Front window is not a draft window!"
  else
    tell front draft window
      if its object = missing value then save
    end tell
  end if
end tell
-------------------------------------------------------------------------------------------
tell application "System Events"
  if quit delay ≠ 0 then set quit delay to 0

  

  tell application process "Microsoft Outlook"
    set frontmost to true

    

    tell (first window whose subrole is "AXStandardWindow")

      

      tell text area 1 of (first scroll area whose description is "To:")
        set toFieldFocus to its focused
      end tell

      

      if toFieldFocus then
        tell (first text field of splitter group 1 whose description is "Subject:")
          set focused to true
        end tell
      end if

      

    end tell

    

  end tell
end tell
-----------------------------------------------------------------------------------------
tell application "Microsoft Outlook"
  tell front draft window
    tell its object
      make new recipient with properties {email address:{name:"Robert A. Heinlein", address:"email@hidden"}}
    end tell
  end tell
end tell
-------------------------------------------------------------------------------------------

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >What is the essential difference between ASOC on Script Editor and Xcode based ASOC app (From: Takaaki Naganoya <email@hidden>)
 >New Recipient in Outlook 2011 (From: Dave <email@hidden>)

  • Prev by Date: LiferayNativity.osax?
  • Next by Date: Re: LiferayNativity.osax?
  • Previous by thread: New Recipient in Outlook 2011
  • Next by thread: Delete Custom Document Property in Word 2011
  • Index(es):
    • Date
    • Thread