G’day folks
This is a last ditch attempt at finding answers to this.
Shane Stanley has helped me so far, and I’m grateful for his help, but he doesn’t know the answer to these questions (if there are any).
He’s shown me how to make an outgoing message using ASObjC, but it appears that adding attachments to the message always adds them at the end, and I need to add them at the start, not at the beginning.
As well, I can’t find out how to actually send the message. All Finder and System Events to an outgoing message are ignored, do how do I send it?
Any advice appreciated, please?
Regards
Santa
on eMailit(the_subject, the_content, theCCRecipientsStore, textcolor)
tell application "Finder"
try
set pathToMe to path to current application as text
set logoPath to pathToMe & "Contents:Resources:Report Logo.png" as text
set PosixLogoPath to POSIX path of logoPath
on error
set logoPath to ""
end try
set p to 2
if ((count of logoPath) as text) < 4 or not (exists file logoPath) then
try
set pathToMe to (path to applications folder) & "Mail Manager:Mail Manager.app:" as text
set logoPath to pathToMe & "Contents:Resources:Report Logo.png" as text
set PosixLogoPath to POSIX path of logoPath
end try
end if
end tell
set p to 2.1
set anNSURL to current application's |NSURL|'s fileURLWithPath:PosixLogoPath
-- make file wrapper from URL
set p to 2.2
set anNSFileWrapper to current application's NSFileWrapper's alloc()'s initWithURL:anNSURL options:0 |error|:(missing value)
-- make attachment from file wrapper
set p to 2.3
set anNSTextAttachment to current application's NSTextAttachment's alloc()'s initWithFileWrapper:anNSFileWrapper
-- make attributed string from attachment
set p to 2.4
set theAttachment to current application's NSAttributedString's attributedStringWithAttachment:anNSTextAttachment
<CODE>
set anNSString to current application's NSString's stringWithString:the_content
set p to 22
set anNSMutableAttributedString to current application's NSMutableAttributedString's alloc()'s initWithString:anNSString attributes:(missing value)
<CODE>
set mailShare to current application's NSSharingService's sharingServiceNamed:(current application's NSSharingServiceNameComposeEmail)
mailShare's setRecipients:{mailRecipients}
mailShare's setSubject:the_subject
# Adds attachment to end, not beginning
mailShare's performWithItems:{theAttachment, anNSMutableAttributedString}
Model: Late 2014 retina i7, Yosemite
AppleScript: 2.4
Browser: Safari 600.2.5
Operating System: Other