Oops -- Lib/Test should be Lib/test, of course!
[python/dscho.git] / Mac / Demo / scripting / testeudora.py
blobbedce44c1a90b2055e376d9d3e30644db35fbd5f
1 """A test program that allows us to control Eudora"""
3 import sys
4 import aetools
5 import Eudora_Suite
6 import Required_Suite
7 import Standard_Suite
8 import MacOS
10 class Eudora(Eudora_Suite.Eudora_Suite, Required_Suite.Required_Suite, \
11 Standard_Suite.Standard_Suite, aetools.TalkTo):
12 """A class that can talk to Eudora"""
13 pass
15 # The Creator signature of eudora:
16 SIGNATURE="CSOm"
18 def main():
19 talker = Eudora(SIGNATURE, start=1)
20 while 1:
21 print 'get, put, name (of first folder), list (foldernames), quit (eudora) or exit (this program) ?'
22 line = sys.stdin.readline()
23 try:
24 if line[0] == 'g':
25 talker.connect(checking=1)
26 elif line[0] == 'p':
27 talker.connect(sending=1)
28 elif line[0] == 'n':
29 id = Eudora_Suite.mailbox(1).name
30 name = talker._get(id, as='text')
31 print "It is called", name
32 elif line[0] == 'l':
33 pass
34 elif line[0] == 'q':
35 talker.quit()
36 elif line[0] == 'e':
37 break
38 except MacOS.Error, arg:
39 if arg[0] == -609:
40 print 'Connection invalid, is eudora running?'
41 else:
42 print 'MacOS Error:', arg[1]
43 except aetools.Error, arg:
44 print 'Eudora returned error:', arg
46 main()