Я могу создать новое исходящее сообщение, а затем прикрепить к нему файлы, но не могу прикрепить к уже открытому окну компоновки, как получить доступ к открытому окну компоновки и затем прикрепить файлы. Ниже приведен код, который я использовал для прикрепления файлов при создании нового окна создания
set userName to short user name of (system info)
set theAttachmentFolder to "/Users/" & userName & "/Documents/Test/" as POSIX file as alias
tell application "Finder" to set attchList to get every file of folder (theAttachmentFolder)
tell application "Mail"
set msg to make new outgoing message with properties{visible:true}
tell msg
repeat with attach in attchList
make new attachment with properties {file name:(contents of attach as alias)}
end repeat
end tell
end tell