-------------------------------------------------------------------------------------------
# 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
-------------------------------------------------------------------------------------------