Re: Woes controlling outgoing messages with Rubycocoa + Scripting Bridge
Re: Woes controlling outgoing messages with Rubycocoa + Scripting Bridge
- Subject: Re: Woes controlling outgoing messages with Rubycocoa + Scripting Bridge
- From: Christopher Nebel <email@hidden>
- Date: Thu, 10 Apr 2008 14:00:10 -0700
On Apr 10, 2008, at 12:23 PM, Scott Russell wrote:
Hi. I'm trying to construct an HTML mail with mail.app, and since I
can't find a straightforward way to do it, I'm using safari and it's
emailContentsOf method. After building my page with ERB, I do the
following:
safariapp =
OSX
::SBApplication.applicationWithBundleIdentifier_("com.apple.safari")
safariapp.open fileName
safariapp.emailContentsOf(safariapp.windows[0].currentTab)
mailapp =
OSX::SBApplication.applicationWithBundleIdentifier_("com.apple.mail")
outgoingMessage = mailapp.outgoingMessages[0]
outgoingMessage.subject = "My Subject"
The result is the following error, which I'm not sure how to parse,
and the launch of gdb, which can't be good:
2008-04-10 14:23:07.099 MailHelper[38806:10b]
MailHelperView#processMail: OSX::OCException: NSGenericException -
Apple event returned an error. Event = 'core'\'setd'{ '----':'obj '{
'want':'prop', 'from':'obj '{ 'want':'bcke', 'from':'null'(),
'form':'indx', 'seld':1 }, 'form':'prop', 'seld':'subj' },
'data':'utxt'("My Subject") }
Error info = {
ErrorExpectedType = <NSAppleEventDescriptor: '****'>;
ErrorNumber = -10006;
ErrorOffendingObject = <SBObject @0x187b05a0: subject of 'obj '{
'from':0x00000000, 'form':'prop', 'seld':'subj', 'want':'prop' }>;
}
Essentially, it's complaining that there's no such message. I'm
afraid this is a long-standing bug in Mail: scripts can't "see"
outgoing messages that weren't created using a script. (That is,
using "make new outgoing message", or to you, alloc-init-addObject.
Safari's "email" command doesn't count.)
I don't believe that Mail publicly supports creating HTML content, but
someone here probably has some clever way around that.
--Chris Nebel
AppleScript Engineering
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden