diff options
author | Jack Jansen <jack.jansen@cwi.nl> | 1995-11-14 11:35:17 (GMT) |
---|---|---|
committer | Jack Jansen <jack.jansen@cwi.nl> | 1995-11-14 11:35:17 (GMT) |
commit | e7bea57d0c0fd3a153cb6d7b230b5da3ad0c4cbd (patch) | |
tree | 970d425ebb3225ffdcb1e413267b8f45e449b900 /Mac/Demo/scripting/testeudora.py | |
parent | 1dcbcc3abfb95669b25828557e576c46f03b501a (diff) | |
download | cpython-e7bea57d0c0fd3a153cb6d7b230b5da3ad0c4cbd.zip cpython-e7bea57d0c0fd3a153cb6d7b230b5da3ad0c4cbd.tar.gz cpython-e7bea57d0c0fd3a153cb6d7b230b5da3ad0c4cbd.tar.bz2 |
Example: control eudora using AppleEvents
Diffstat (limited to 'Mac/Demo/scripting/testeudora.py')
-rw-r--r-- | Mac/Demo/scripting/testeudora.py | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/Mac/Demo/scripting/testeudora.py b/Mac/Demo/scripting/testeudora.py new file mode 100644 index 0000000..4c83085 --- /dev/null +++ b/Mac/Demo/scripting/testeudora.py @@ -0,0 +1,41 @@ +"""A test program that allows us to control Eudora""" + +import sys +import addpack +addpack.addpack('Tools') +addpack.addpack('bgen') +addpack.addpack('ae') +import aetools +import Eudora_Suite +import Required_Suite +import MacOS + +class Eudora(aetools.TalkTo, Required_Suite.Required_Suite, \ + Eudora_Suite.Eudora_Suite): + """A class that can talk to Eudora""" + pass + +# The Creator signature of eudora: +SIGNATURE="????" + +def main(): + talker = Eudora(SIGNATURE) + while 1: + print 'get, put, quit (eudora) or exit (this program) ?' + line = sys.stdin.readline() + try: + if line[0] == 'g': + talker.connect(checking=1) + elif line[0] == 'p': + talker.connect(sending=1) + elif line[0] == 'q': + talker.quit() + elif line[0] == 'e': + break + except MacOS.Error, arg: + if arg[0] == -609: + print 'Connection invalid, is eudora running?' + else: + print 'Error, possibly ', arg[1] + +main() |