-------------------------------------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2017/02/12 18:04
# dMod: 2017/02/12 18:22
# Appl: Apple Mail & System Events
# Task: Press the “Load Remote Content” button if it exists in an open message or a message-viewer.
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @System_Events, @Press, @Load, @Remote, @Content, @Button, @Message-viewer, @Message
# Test: macOS 10.12.3 only at this time.
-------------------------------------------------------------------------------------------
tell application "System Events"
tell application process "Mail"
tell (first window whose subrole is "AXStandardWindow")
try
# Front window is a message-viewer.
tell button "Load Remote Content" of group 1 of group 1 of scroll area 1 of splitter group 1 of splitter group 1
perform action "AXPress"
end tell
on error
try
# Front window is an open message.
tell button "Load Remote Content" of group 1 of group 1 of scroll area 1
if it exists then
perform action "AXPress"
end if
end tell
end try
end try
end tell
end tell
end tell
-------------------------------------------------------------------------------------------