Any help from others on the list about how I can "write" the CC
field of the current open Mail message would be greatly appreciated.
This is possible when scripting the creation of a new outgoing
message, Peter. The following, for example, should work:
--------------
tell application "Mail"
set new_message to make outgoing message ¬
with properties {subject:"test", visible:true}
tell new_message to make cc recipient ¬
with properties {address:"email@hidden"}
end tell
--------------
However, a problem arises with messages that have been created
manually, or have been saved, closed and then reopened. I'm afraid
it's just one of a number of Mail scripting issues.
Until the situation improves, you might like to try a workaround that
relies on GUI scripting (which should therefore be enabled):
--------------
set CC_address to "email@hidden"
tell application "System Events" to tell process "Mail"'s window 1
tell text field 1 of scroll area 2 to if exists then
set value of attribute "AXFocused" to true
set value of attribute "AXValue" to CC_address
end if
tell scroll area -1 to if exists then ¬
set value of attribute "AXFocused" to true
end tell