Email:   
Home
In This Issue
EasyPrint
Click here for the RSS feed's XML code. This is not a browser URL.
Using Python to create a command line interpreter for Notes (continued)

However, unlike other scripting tools such as VBScript, JavaScript, or LotusScript, it's fast and powerful enough to write Web browsers, Web servers, virtual reality modeling systems, CORBA brokers, and database servers. For a flavor of what's possible for Python programmers, check out the Zope Web application server (at http://www.zope.org), the Ultraseek search engine (at http://www.ultraseek.com), or the eGroups discussion groups site (at http://www.egroups.com), all of which are written in almost 100% Python.

Aside from its ability as a general development language, Python is designed to work well with other systems, such as Lotus Notes, or as an alternative scripting language in Active Server Pages. It's also designed to allow users to shift easily from using it as a console command tool to writing scripts and classes. A huge support library of ready-made classes makes XML, graphics, database, and email programming snappy and simple.

There are three quite different ways to make Python interact with a Lotus Notes client or Domino server:

  • Use Domino's interface to the Microsoft COM (Component Object Model) or OLE (Object Linking and Embedding) standard;
  • Use the Lotus.Domino Java classes;
  • Use the Notes C++ API.

Using COM
This method is naturally limited to Windows 9X or Windows NT platforms. To get started with Python on Windows, download the PythonWin implementation from http://starship.python.net/crew/mhammond/. This has an easy-to-use interface, Win32 DLL (Dynamic Link Library) support, ASP (Active Server Pages) integration, and the color-coded syntax that even the LotusScript IDE (Interactive Development Environment) now has in R5. Most importantly, PythonWin hooks into Microsoft's COM, also known as ActiveX and OLE. There will be more on that in a minute. For now, download and run the PythonWin installer, and within minutes you should be sitting with the command screen shown in Figure A.

FIGURE A

Here's the Python command line interface with a classic "Hello World" programming sample. Click picture for a larger image.

As you can see, the basic Python syntax is very simple and not too distant from LotusScript. The basic keywords are used to teach children computing languages. The single idiosyncrasy some people find to be an obstacle is that indentation in control structures, such as FOR loops and IF THEN ENDIF blocks, is mandatory. You must press Tab to indent code within such blocks. Python programmers point to the spaghetti code that results, especially in Perl and C, from the lack of this mandate in other languages.

This article isn't going to teach you Python. There are plenty of good books and Web sites already doing that. However, you can use it quite happily as a command line interpreter without knowing much of the language. Knowledge of the Lotus classes being used is much more critical.

Linking to Lotus Notes
The next stage--linking to Lotus Notes--requires a little understanding of Microsoft's COM (current name), OLE (old name for the same thing), and ActiveX (Microsoft's marketing department's name for it).




[ Prev | Next ]

ZATZ Home  ·  News  ·  Back Issues  ·  Credits/Trademarks ·  Link To Us
-- Advertisement --

2-Minute Tutorials
How do I...

  • integrate MS Office or OpenOffice with Notes?
  • create cross-tab reports and charts?
  • print serial letters and mailing labels?
  • create PDFs in Lotus Notes?


Check out the 2-minute tutorials here.
-- Advertisement --

Get in the Spotlight! Teamstudio Spotlight Awards 2009
For the second year, Teamstudio is holding the Teamstudio Spotlight Awards Contest to recognize developers of the Notes community for their most remarkable Notes applications! Winners will be announced at Lotusphere 2009 January and featured in DominoPower in the month of February. Prizes to include:

1st Prize: Your choice of one configured software product with installation at one site, Teamstudio's complete suite of tools for one user and an iPod Touch.
2nd Prize: Teamstudio's complete suite of tools.
3rd Prize: One tool of your choice.

For more information on how to enter, click here!

Copyright © 1998-2008, ZATZ Publishing. All rights reserved worldwide.
Editor's Login