• 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
Woes controlling outgoing messages with Rubycocoa + Scripting Bridge
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Woes controlling outgoing messages with Rubycocoa + Scripting Bridge


  • Subject: Woes controlling outgoing messages with Rubycocoa + Scripting Bridge
  • From: "Scott Russell" <email@hidden>
  • Date: Thu, 10 Apr 2008 15:23:04 -0400

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' }>;
}

I get similar (but different) errors if I try to print the existing
subject, or attach a recipient to toRecipients.  To my uneducated eye,
it seems the message either isn't fully instantiated ( a sleep does
not help matters) or not giving me permission to make the changes.
Can anyone explain the problem, and give me a path to finding a
solution?

BTW, This works fine if I create the message myself instead, with

outgoingMessage = mailapp.classForScriptingClass("outgoing
message").alloc.initWithProperties({:visible=>true})

Thanks in advance for any help you can give!  I'm also open to better
ways of doing this whole procedure. :)
 _______________________________________________
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

  • Follow-Ups:
    • Re: Woes controlling outgoing messages with Rubycocoa + Scripting Bridge
      • From: Christopher Nebel <email@hidden>
  • Prev by Date: Address Book: set property values dynamically
  • Next by Date: Address Book: Getting a reference to email by ID
  • Previous by thread: Re: Address Book: set property values dynamically
  • Next by thread: Re: Woes controlling outgoing messages with Rubycocoa + Scripting Bridge
  • Index(es):
    • Date
    • Thread