[PYTHONMAC-SIG] AppleEvents to Eudora

Doug Wyatt doug@sonosphere.com
Fri, 20 Jun 1997 08:52:52 -0400


Hello all,

I've read enough of the tutorial on AppleEvents/scripting to know that the
answer to this is non-obvious ... :)

This little bit of AppleScript works, but I want to do it in Python:

	-- mailTo, mailSubject and msgText are variables
	tell application "Eudora Pro"
		activate
		make message at end of mailbox "out" of mail folder ""
		set field "to" of message 0 to mailTo
		set field "subject" of message 0 to mailSubject
		set field "" of message 0 to msgText
		queue message 0
		connect with sending without checking
		quit
	end tell

I've successfully scripted CodeWarrior and Anarchie a bit, so I'm not
concerned with the simple verbs with parameters, like activate, queue
message, connect and quit.  But I don't know what I'm doing with the 'make'
message.  Here's what I've tried:

class Eudora (aetools.TalkTo, Required_Suite.Required_Suite, \
		Standard_Suite.Standard_Suite, Eudora_Suite.Eudora_Suite):
	"""A class that can talk to Eudora"""
	kSig = 'CSOm'

from aetypes import ComponentItem
template = """		# copied from aetypes
class %s(ComponentItem): want = '%s'
"""
exec template % ('EuMailFolder','euMF')
exec template % ('EuMailbox', 'euMB')
exec template % ('EuMessage', 'euMS')

	eu = Eudora(Eudora.kSig, start=1)
	eu.make(None, new='message', at=EuMailbox('Out', EuMailFolder('')))

Maybe the problem is as simple as my not knowing how to specify the end of
the mailbox, or maybe I completely don't know what I'm doing.  I'd
appreciate any small pointers.  Thanks,

Doug


---
Doug Wyatt                      music [,] software
doug@sonosphere.com             http://www.sonosphere.com/
new streaming audio samples:    http://www.sonosphere.com/doug/music.html



_______________
PYTHONMAC-SIG  - SIG on Python for the Apple Macintosh

send messages to: pythonmac-sig@python.org
administrivia to: pythonmac-sig-request@python.org
_______________