testeudora.py :  » Language-Interface » ChinesePython » chinesepython2.1.3-0.4 » Mac » Contrib » PythonScript » Python Open Source

Home
Python Open Source
1.3.1.2 Python
2.Ajax
3.Aspect Oriented
4.Blog
5.Build
6.Business Application
7.Chart Report
8.Content Management Systems
9.Cryptographic
10.Database
11.Development
12.Editor
13.Email
14.ERP
15.Game 2D 3D
16.GIS
17.GUI
18.IDE
19.Installer
20.IRC
21.Issue Tracker
22.Language Interface
23.Log
24.Math
25.Media Sound Audio
26.Mobile
27.Network
28.Parser
29.PDF
30.Project Management
31.RSS
32.Search
33.Security
34.Template Engines
35.Test
36.UML
37.USB Serial
38.Web Frameworks
39.Web Server
40.Web Services
41.Web Unit
42.Wiki
43.Windows
44.XML
Python Open Source » Language Interface » ChinesePython 
ChinesePython » chinesepython2.1.3 0.4 » Mac » Contrib » PythonScript » testeudora.py
"""A test program that allows us to control Eudora"""

import sys
import MacOS
import PythonScript
  
# The Creator signature of eudora:
SIGNATURE="CSOm"
TIMEOUT = 10*60*60



def main():
  PythonScript.PsScript(SIGNATURE, TIMEOUT)
  talker = PythonScript.PyScript
  ev = PythonScript.PsEvents
  pc = PythonScript.PsClass
  while 1:
    print 'get, put, name (of first folder), list (foldernames), quit (eudora) or exit (this program) ?'
    line = sys.stdin.readline()
    try:
      if line[0] == 'g':
        print 'check'
        print talker(ev.Activate)
        print talker(ev.Connect, Checking=1)
      elif line[0] == 'p':
        print talker(ev.Connect, Sending=1)
      elif line[0] == 'n':
        id = talker(ev.Get, pc.Mail_folder("").Mailbox(1).Name())
        print "It is called", id, "\n"
      elif line[0] == 'l':
        id = talker(ev.Count, pc.Mail_folder(""), Each='Mailbox')
        print "There are", id, "mailboxes"
      elif line[0] == 'q':
        print talker(ev.Quit)
      elif line[0] == 'e':
        break
    except MacOS.Error, arg:
      if arg[0] == -609:
        print 'Connection invalid, is eudora running?'
      else:
        print 'MacOS Error:', arg[1]
      
main()
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.