Improved some error messages for command line processing.
[python/dscho.git] / Mac / Demo / scripting / Eudora_Suite.py
blobe3383f5aa58511dd83df9dbb410023eddab38cbc
1 """Suite Eudora Suite: Terms specific to Eudora
2 Level 1, version 1
4 Generated from flap:Programma's:Eudora Light
5 AETE/AEUT resource version 2/16, language 0, script 0
6 """
8 import aetools
9 import MacOS
11 _code = 'CSOm'
13 class Eudora_Suite:
15 _argmap_connect = {
16 'sending' : 'eSen',
17 'checking' : 'eChk',
18 'waiting' : 'eIdl',
21 def connect(self, _no_object=None, _attributes={}, **_arguments):
22 """connect: Connect to the mail server and transfer mail
23 Keyword argument sending: true to make eudora send queued messages
24 Keyword argument checking: true to make eudora check for mail
25 Keyword argument waiting: true to make eudora wait for idle time before checking
26 Keyword argument _attributes: AppleEvent attribute dictionary
27 """
28 _code = 'CSOm'
29 _subcode = 'eCon'
31 aetools.keysubst(_arguments, self._argmap_connect)
32 if _no_object != None: raise TypeError, 'No direct arg expected'
35 _reply, _arguments, _attributes = self.send(_code, _subcode,
36 _arguments, _attributes)
37 if _arguments.has_key('errn'):
38 raise aetools.Error, aetools.decodeerror(_arguments)
39 # XXXX Optionally decode result
40 if _arguments.has_key('----'):
41 return _arguments['----']
43 _argmap_reply = {
44 'quoting' : 'eQTx',
45 'everyone' : 'eRAl',
46 'self' : 'eSlf',
49 def reply(self, _object, _attributes={}, **_arguments):
50 """reply: Reply to a message
51 Required argument: the message to reply to
52 Keyword argument quoting: true if you want to quote the original text in the reply
53 Keyword argument everyone: true if you want the reply to go to everyone who got the original
54 Keyword argument self: true if you want the reply to go to yourself, too
55 Keyword argument _attributes: AppleEvent attribute dictionary
56 Returns: to the reply message
57 """
58 _code = 'CSOm'
59 _subcode = 'eRep'
61 aetools.keysubst(_arguments, self._argmap_reply)
62 _arguments['----'] = _object
65 _reply, _arguments, _attributes = self.send(_code, _subcode,
66 _arguments, _attributes)
67 if _arguments.has_key('errn'):
68 raise aetools.Error, aetools.decodeerror(_arguments)
69 # XXXX Optionally decode result
70 if _arguments.has_key('----'):
71 return _arguments['----']
73 def forward(self, _object, _attributes={}, **_arguments):
74 """forward: Forward a message
75 Required argument: the message to forward
76 Keyword argument _attributes: AppleEvent attribute dictionary
77 Returns: to the forwarded message
78 """
79 _code = 'CSOm'
80 _subcode = 'eFwd'
82 if _arguments: raise TypeError, 'No optional args expected'
83 _arguments['----'] = _object
86 _reply, _arguments, _attributes = self.send(_code, _subcode,
87 _arguments, _attributes)
88 if _arguments.has_key('errn'):
89 raise aetools.Error, aetools.decodeerror(_arguments)
90 # XXXX Optionally decode result
91 if _arguments.has_key('----'):
92 return _arguments['----']
94 def redirect(self, _object, _attributes={}, **_arguments):
95 """redirect: Redirect a message
96 Required argument: the message to redirect
97 Keyword argument _attributes: AppleEvent attribute dictionary
98 Returns: to the redirected message
99 """
100 _code = 'CSOm'
101 _subcode = 'eRdr'
103 if _arguments: raise TypeError, 'No optional args expected'
104 _arguments['----'] = _object
107 _reply, _arguments, _attributes = self.send(_code, _subcode,
108 _arguments, _attributes)
109 if _arguments.has_key('errn'):
110 raise aetools.Error, aetools.decodeerror(_arguments)
111 # XXXX Optionally decode result
112 if _arguments.has_key('----'):
113 return _arguments['----']
115 def send_again(self, _object, _attributes={}, **_arguments):
116 """send again: Send a message again
117 Required argument: the message to send again
118 Keyword argument _attributes: AppleEvent attribute dictionary
119 Returns: to the message sent again
121 _code = 'CSOm'
122 _subcode = 'eSav'
124 if _arguments: raise TypeError, 'No optional args expected'
125 _arguments['----'] = _object
128 _reply, _arguments, _attributes = self.send(_code, _subcode,
129 _arguments, _attributes)
130 if _arguments.has_key('errn'):
131 raise aetools.Error, aetools.decodeerror(_arguments)
132 # XXXX Optionally decode result
133 if _arguments.has_key('----'):
134 return _arguments['----']
136 _argmap_queue = {
137 '_for' : 'eWhn',
140 def queue(self, _object, _attributes={}, **_arguments):
141 """queue: Queue a message to be sent
142 Required argument: the message to queue
143 Keyword argument _for: date to send the message, in seconds since 1904, UTC
144 Keyword argument _attributes: AppleEvent attribute dictionary
146 _code = 'CSOm'
147 _subcode = 'eQue'
149 aetools.keysubst(_arguments, self._argmap_queue)
150 _arguments['----'] = _object
153 _reply, _arguments, _attributes = self.send(_code, _subcode,
154 _arguments, _attributes)
155 if _arguments.has_key('errn'):
156 raise aetools.Error, aetools.decodeerror(_arguments)
157 # XXXX Optionally decode result
158 if _arguments.has_key('----'):
159 return _arguments['----']
161 def unqueue(self, _object, _attributes={}, **_arguments):
162 """unqueue: Remove a message from the queue, so it won¹t be sent
163 Required argument: the message to unqueue
164 Keyword argument _attributes: AppleEvent attribute dictionary
166 _code = 'CSOm'
167 _subcode = 'eUnQ'
169 if _arguments: raise TypeError, 'No optional args expected'
170 _arguments['----'] = _object
173 _reply, _arguments, _attributes = self.send(_code, _subcode,
174 _arguments, _attributes)
175 if _arguments.has_key('errn'):
176 raise aetools.Error, aetools.decodeerror(_arguments)
177 # XXXX Optionally decode result
178 if _arguments.has_key('----'):
179 return _arguments['----']
181 _argmap_attach_to = {
182 'documents' : 'eDcl',
185 def attach_to(self, _object, _attributes={}, **_arguments):
186 """attach to: Attach documents to a message
187 Required argument: the message to attach the documents to
188 Keyword argument documents: list of documents to attach
189 Keyword argument _attributes: AppleEvent attribute dictionary
191 _code = 'CSOm'
192 _subcode = 'eAtc'
194 aetools.keysubst(_arguments, self._argmap_attach_to)
195 _arguments['----'] = _object
198 _reply, _arguments, _attributes = self.send(_code, _subcode,
199 _arguments, _attributes)
200 if _arguments.has_key('errn'):
201 raise aetools.Error, aetools.decodeerror(_arguments)
202 # XXXX Optionally decode result
203 if _arguments.has_key('----'):
204 return _arguments['----']
206 _argmap_start_notifying = {
207 'when' : 'eWHp',
210 def start_notifying(self, _object, _attributes={}, **_arguments):
211 """start notifying: Notify an application of things that happen
212 Required argument: an application to notify
213 Keyword argument when: what to notify the application of
214 Keyword argument _attributes: AppleEvent attribute dictionary
216 _code = 'CSOm'
217 _subcode = 'nIns'
219 aetools.keysubst(_arguments, self._argmap_start_notifying)
220 _arguments['----'] = _object
223 _reply, _arguments, _attributes = self.send(_code, _subcode,
224 _arguments, _attributes)
225 if _arguments.has_key('errn'):
226 raise aetools.Error, aetools.decodeerror(_arguments)
227 # XXXX Optionally decode result
228 if _arguments.has_key('----'):
229 return _arguments['----']
231 _argmap_stop_notifying = {
232 'when' : 'eWHp',
235 def stop_notifying(self, _object, _attributes={}, **_arguments):
236 """stop notifying: Stop notifying applications of things that are happening
237 Required argument: an application currently being notified
238 Keyword argument when: the things no longer to notify it of
239 Keyword argument _attributes: AppleEvent attribute dictionary
241 _code = 'CSOm'
242 _subcode = 'nRem'
244 aetools.keysubst(_arguments, self._argmap_stop_notifying)
245 _arguments['----'] = _object
248 _reply, _arguments, _attributes = self.send(_code, _subcode,
249 _arguments, _attributes)
250 if _arguments.has_key('errn'):
251 raise aetools.Error, aetools.decodeerror(_arguments)
252 # XXXX Optionally decode result
253 if _arguments.has_key('----'):
254 return _arguments['----']
256 _argmap_notice = {
257 'occurrence' : 'eWHp',
258 'messages' : 'eMLs',
261 def notice(self, _no_object=None, _attributes={}, **_arguments):
262 """notice: Eudora sends this event to notify an application that something happened
263 Keyword argument occurrence: what happened
264 Keyword argument messages: of the messages involved
265 Keyword argument _attributes: AppleEvent attribute dictionary
267 _code = 'CSOm'
268 _subcode = 'eNot'
270 aetools.keysubst(_arguments, self._argmap_notice)
271 if _no_object != None: raise TypeError, 'No direct arg expected'
273 aetools.enumsubst(_arguments, 'eWHp', _Enum_eNot)
275 _reply, _arguments, _attributes = self.send(_code, _subcode,
276 _arguments, _attributes)
277 if _arguments.has_key('errn'):
278 raise aetools.Error, aetools.decodeerror(_arguments)
279 # XXXX Optionally decode result
280 if _arguments.has_key('----'):
281 return _arguments['----']
284 class mail_folder(aetools.ComponentItem):
285 """mail folder - A folder containing mailboxes or other mail folders."""
286 want = 'euMF'
287 class name(aetools.NProperty):
288 """name - the name"""
289 which = 'pnam'
290 want = 'itxt'
291 # element 'euMB' as ['indx', 'name']
292 # element 'euMF' as ['indx', 'name']
294 class mailbox(aetools.ComponentItem):
295 """mailbox - A mailbox."""
296 want = 'euMB'
297 # repeated property name the name of the mail folder
298 class space_wasted(aetools.NProperty):
299 """space wasted - the amount of waste space in the mailbox"""
300 which = 'euWS'
301 want = 'long'
302 class space_required(aetools.NProperty):
303 """space required - the minimum amount of space required to hold the mailbox"""
304 which = 'euNS'
305 want = 'long'
306 class location(aetools.NProperty):
307 """location - the file the mailbox is stored in"""
308 which = 'euFS'
309 want = 'fss '
310 class toc_location(aetools.NProperty):
311 """toc location - the file the table of contents is stored in"""
312 which = 'eTFS'
313 want = 'fss '
314 # element 'euMS' as ['indx']
316 class message(aetools.ComponentItem):
317 """message - A message"""
318 want = 'euMS'
319 class body(aetools.NProperty):
320 """body - the body of the message"""
321 which = 'eBod'
322 want = 'TEXT'
323 class priority(aetools.NProperty):
324 """priority - the priority"""
325 which = 'euPY'
326 want = 'long'
327 class label(aetools.NProperty):
328 """label - the index of the label"""
329 which = 'eLbl'
330 want = 'long'
331 class status(aetools.NProperty):
332 """status - the message status"""
333 which = 'euST'
334 want = 'eSta'
335 class sender(aetools.NProperty):
336 """sender - the sender as appearing in the message summary"""
337 which = 'euSe'
338 want = 'itxt'
339 class date(aetools.NProperty):
340 """date - the date as appearing in the message summary"""
341 which = 'euDa'
342 want = 'itxt'
343 class subject(aetools.NProperty):
344 """subject - the subject as appearing in the message summary"""
345 which = 'euSu'
346 want = 'itxt'
347 class size(aetools.NProperty):
348 """size - the size of the message"""
349 which = 'euSi'
350 want = 'long'
351 class outgoing(aetools.NProperty):
352 """outgoing - is the message is outgoing?"""
353 which = 'euOu'
354 want = 'bool'
355 class signature(aetools.NProperty):
356 """signature - which signature the message should have"""
357 which = 'eSig'
358 want = 'eSig'
359 class QP(aetools.NProperty):
360 """QP - is Eudora allowed to encode text?"""
361 which = 'eMQP'
362 want = 'bool'
363 class return_receipt(aetools.NProperty):
364 """return receipt - is a return receipt is requested?"""
365 which = 'eRRR'
366 want = 'bool'
367 class wrap(aetools.NProperty):
368 """wrap - should the text be wrapped when sent?"""
369 which = 'eWrp'
370 want = 'bool'
371 class tab_expansion(aetools.NProperty):
372 """tab expansion - should tabs get expanded to spaces?"""
373 which = 'eTab'
374 want = 'bool'
375 class keep_copy(aetools.NProperty):
376 """keep copy - should a copy should be kept after message is sent?"""
377 which = 'eCpy'
378 want = 'bool'
379 class preserve_macintosh_info(aetools.NProperty):
380 """preserve macintosh info - should Macintosh information always be sent with attachments?"""
381 which = 'eXTX'
382 want = 'bool'
383 class attachment_encoding(aetools.NProperty):
384 """attachment encoding - the type of encoding to use for attachments"""
385 which = 'eATy'
386 want = 'eAty'
387 class show_all_headers(aetools.NProperty):
388 """show all headers - should all headers be visible?"""
389 which = 'eBla'
390 want = 'bool'
391 class transliteration_table(aetools.NProperty):
392 """transliteration table - the resource id of the transliteration table"""
393 which = 'eTbl'
394 want = 'long'
395 class will_be_fetched(aetools.NProperty):
396 """will be fetched - will the message be [re]fetched on next check?"""
397 which = 'eWFh'
398 want = 'bool'
399 class will_be_deleted(aetools.NProperty):
400 """will be deleted - will the message be deleted from server on next check?"""
401 which = 'eWDl'
402 want = 'bool'
403 # element 'euFd' as ['name']
405 class field(aetools.ComponentItem):
406 """field - An RFC 822 header field in a message (field named "" is the body)"""
407 want = 'euFd'
409 class setting(aetools.ComponentItem):
410 """setting - Eudora's settings"""
411 want = 'ePrf'
412 mail_folder._propdict = {
413 'name' : name,
415 mail_folder._elemdict = {
416 'mailbox' : mailbox,
417 'mail_folder' : mail_folder,
419 mailbox._propdict = {
420 'name' : name,
421 'space_wasted' : space_wasted,
422 'space_required' : space_required,
423 'location' : location,
424 'toc_location' : toc_location,
426 mailbox._elemdict = {
427 'message' : message,
429 message._propdict = {
430 'body' : body,
431 'priority' : priority,
432 'label' : label,
433 'status' : status,
434 'sender' : sender,
435 'date' : date,
436 'subject' : subject,
437 'size' : size,
438 'outgoing' : outgoing,
439 'signature' : signature,
440 'QP' : QP,
441 'return_receipt' : return_receipt,
442 'wrap' : wrap,
443 'tab_expansion' : tab_expansion,
444 'keep_copy' : keep_copy,
445 'preserve_macintosh_info' : preserve_macintosh_info,
446 'attachment_encoding' : attachment_encoding,
447 'show_all_headers' : show_all_headers,
448 'transliteration_table' : transliteration_table,
449 'will_be_fetched' : will_be_fetched,
450 'will_be_deleted' : will_be_deleted,
452 message._elemdict = {
453 'field' : field,
455 field._propdict = {
457 field._elemdict = {
459 setting._propdict = {
461 setting._elemdict = {
463 _Enum_eSta = {
464 'unread' : 'euS\001', # has not been read
465 'already_read' : 'euS\002', # has been read
466 'replied' : 'euS\003', # has been replied to
467 'forwarded' : 'euS\010', # has been forwarded
468 'redirected' : 'euS\004', # has been redirected
469 'not_sendable' : 'euS\005', # cannot be sent
470 'sendable' : 'euS\006', # can be sent
471 'queued' : 'euS\007', # queued for delivery
472 'sent' : 'euS\011', # has been sent
473 'never_sent' : 'euS\012', # never was sent
476 _Enum_eSig = {
477 'none' : 'sig\000', # no signature
478 'standard' : 'sig\001', # standard signature file
479 'alternate' : 'sig\002', # alternate signature file
482 _Enum_eAty = {
483 'AppleDouble' : 'atc\000', # AppleDouble format
484 'AppleSingle' : 'atc\001', # AppleSingle format
485 'BinHex' : 'atc\002', # BinHex format
486 'uuencode' : 'atc\003', # uuencode format
489 _Enum_eNot = {
490 'mail_arrives' : 'wArv', # mail arrival
491 'mail_sent' : 'wSnt', # mail has been sent
492 'will_connect' : 'wWCn', # eudora is about to connect to a mail server
493 'has_connected' : 'wHCn', # eudora has finished talking to a mail server
494 'has_manually_filtered' : 'mFil', # eudora has finished manually filtering messages
495 'opens_filters' : 'wFil', # user has requested Eudora open the filter window
500 # Indices of types declared in this module
502 _classdeclarations = {
503 'euMB' : mailbox,
504 'euMS' : message,
505 'euMF' : mail_folder,
506 'ePrf' : setting,
507 'euFd' : field,
510 _propdeclarations = {
511 'eWFh' : will_be_fetched,
512 'euDa' : date,
513 'euSi' : size,
514 'eRRR' : return_receipt,
515 'pnam' : name,
516 'euSe' : sender,
517 'eWrp' : wrap,
518 'eSig' : signature,
519 'euOu' : outgoing,
520 'eMQP' : QP,
521 'eTFS' : toc_location,
522 'eWDl' : will_be_deleted,
523 'eLbl' : label,
524 'eATy' : attachment_encoding,
525 'euSu' : subject,
526 'eBla' : show_all_headers,
527 'eCpy' : keep_copy,
528 'euWS' : space_wasted,
529 'eBod' : body,
530 'euNS' : space_required,
531 'eTab' : tab_expansion,
532 'eTbl' : transliteration_table,
533 'eXTX' : preserve_macintosh_info,
534 'euFS' : location,
535 'euST' : status,
536 'euPY' : priority,
539 _compdeclarations = {
542 _enumdeclarations = {
543 'eAty' : _Enum_eAty,
544 'eNot' : _Enum_eNot,
545 'eSta' : _Enum_eSta,
546 'eSig' : _Enum_eSig,