• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Woes controlling outgoing messages with Rubycocoa + Scripting Bridge
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
References: 
 >Woes controlling outgoing messages with Rubycocoa + Scripting Bridge (From: "Scott Russell" <email@hidden>)

  • Prev by Date: Scripts works with OSX 10.5 but not earlier because of Unicode
  • Next by Date: Re: Mail script not working on Leopard
  • Previous by thread: Woes controlling outgoing messages with Rubycocoa + Scripting Bridge
  • Next by thread: Address Book: Getting a reference to email by ID
  • Index(es):
    • Date
    • Thread