示例#1
0
def SetupNotesClient(verbose):
    makepy.GenerateFromTypeLibSpec('Lotus Domino Objects',
                                   bForDemand=0,
                                   verboseLevel=verbose)
    makepy.GenerateFromTypeLibSpec('IBM Notes Automation Classes',
                                   bForDemand=0,
                                   verboseLevel=verbose)
    notesSession = win32com.client.Dispatch('Lotus.NotesSession')
    notesSession.Initialize("")
    return notesSession
示例#2
0
def TestBuildAll(verbose=1):
    num = 0
    tlbInfos = selecttlb.EnumTlbs()
    for info in tlbInfos:
        if verbose:
            print("%s (%s)" % (info.desc, info.dll))
        try:
            makepy.GenerateFromTypeLibSpec(info)
            #          sys.stderr.write("Attr typeflags for coclass referenced object %s=%d (%d), typekind=%d\n" % (name, refAttr.wTypeFlags, refAttr.wTypeFlags & pythoncom.TYPEFLAG_FDUAL,refAttr.typekind))
            num += 1
        except pythoncom.com_error as details:
            # Ignore these 2 errors, as the are very common and can obscure
            # useful warnings.
            if details.hresult not in [
                    winerror.TYPE_E_CANTLOADLIBRARY,
                    winerror.TYPE_E_LIBNOTREGISTERED,
            ]:
                print("** COM error on", info.desc)
                print(details)
        except KeyboardInterrupt:
            print("Interrupted!")
            raise KeyboardInterrupt
        except:
            print("Failed:", info.desc)
            traceback.print_exc()
        if makepy.bForDemandDefault:
            # This only builds enums etc by default - build each
            # interface manually
            tinfo = (info.clsid, info.lcid, info.major, info.minor)
            mod = gencache.EnsureModule(info.clsid, info.lcid, info.major,
                                        info.minor)
            for name in mod.NamesToIIDMap.keys():
                makepy.GenerateChildFromTypeLibSpec(name, tinfo)
    return num
示例#3
0
def makepy_hilltop(hlib='Hilltop Data Access'):
    """
    Function to generate the Hilltop COM module.

    Parameters
    ----------
    hlib : str
        The name of the COM library.

    Returns
    -------
    None
    """
    makepy.GenerateFromTypeLibSpec(hlib, verboseLevel=1)
示例#4
0
def TestBuildAll(verbose = 1):
    num = 0
    tlbInfos = selecttlb.EnumTlbs()
    for info in tlbInfos:
        if verbose:
            print "%s (%s)" % (info.desc, info.dll)
        try:
            makepy.GenerateFromTypeLibSpec(info)
#          sys.stderr.write("Attr typeflags for coclass referenced object %s=%d (%d), typekind=%d\n" % (name, refAttr.wTypeFlags, refAttr.wTypeFlags & pythoncom.TYPEFLAG_FDUAL,refAttr.typekind))
            num += 1
        except pythoncom.com_error, details:
            # Ignore these 2 errors, as the are very common and can obscure
            # useful warnings.
            if details[0] not in [winerror.TYPE_E_CANTLOADLIBRARY,
                              winerror.TYPE_E_LIBNOTREGISTERED]:
                print "** COM error on", info.desc
                print details
        except KeyboardInterrupt:
            print "Interrupted!"
            raise KeyboardInterrupt
    def Generate( self, typeLibrary):
        """ Generate wrapper for a given type library """
        progress = Progress( self )

        try:
            makepy.GenerateFromTypeLibSpec(
                typeLibrary, None,
                bForDemand = 1,
                bBuildHidden = 1,
                progressInstance = progress,
            )
            filename =progress.filename
            progress.Destroy()
        except Exception, error:
            traceback.print_exc()
            errorMessage =wx.MessageDialog( self, str(error), "Generation Failure!", style=wx.OK)
            progress.Destroy()
            errorMessage.ShowModal()
            errorMessage.Destroy()
            return None
def send_mail(server, db_file, reciver_list, subject, body=None):
    pythoncom.CoInitialize()
    makepy.GenerateFromTypeLibSpec('Lotus Domino Objects')
    logger.info('init mail client')
    session = DispatchEx('Notes.NotesSession')
    db = session.GetDatabase(server, db_file)
    if not db.IsOpen:
        logger.info('open mail db')
        try:
            db.OPENMAIL
        except Exception as e:
            logger.info('could not open database')

    logger.info("Send email ing")
    doc = db.CREATEDOCUMENT
    doc.sendto = reciver_list
    doc.Subject = subject
    if body:
        doc.Body = body
    doc.SEND(0, reciver_list)
    logger.info('send success')
## This script copies all of the Calendar entries from the Lotus Notes Calendar to you Outlook Calendar                                      ##
## Author: Thomas Land																														 ##
## E-Mail: [email protected]                                                                                                                 ##
## Twitter: @thomaslandjr        																											 ##
## I am not responsible for code that you have changed yourself, if you do not understand what a change will do, leave it alone!             ##
## Refer to the documentation sent with this code to configure it yourself.																	 ##
###############################################################################################################################################

# The following code will import the necessary libraries to run this script.
from win32com.client import makepy
from win32com.client import Dispatch
from win32com.client import constants
import getpass, os, tempfile, re

# The following code will generate the objects that this script needs to interact with Lotus Notes
makepy.GenerateFromTypeLibSpec('Lotus Domino Objects')
makepy.GenerateFromTypeLibSpec('Lotus Notes Automation Classes')


# The following function will create a generator for Lotus Notes Calendar Entries
def iterCal(entries):
    entry = entries.GetFirstDocument()
    while entry:
        yield entry
        entry = entries.GetNextDocument(entry)


# The Following function will add Lotus Notes Calendar Entries to your Outlook Calendar
def addToOutlook(subject, location, body, startTime, endTime, required):
    cal = Dispatch('Outlook.Application')
    namespace = cal.GetNamespace("MAPI")
示例#8
0
# encoding: gb2312
# notes 9.0
'''
@author: k
@contact: [email protected]
@file: *********
@time: 2019/12/25 16:43
@desc:
'''

from win32com.client import DispatchEx
from win32com.client import makepy

makepy.GenerateFromTypeLibSpec('Lotus Domino Objects')


class NotesMail(object):
    def __init__(self, server, file):
        print('init mail client')
        self.session = DispatchEx('Notes.NotesSession')
        self.db = self.session.GetDatabase(server, file)
        if not self.db.IsOpen:
            print('open mail db')
            try:
                self.db.OPENMAIL
            except Exception as e:
                print(str(e))
                print('could not open database: {}'.format(db_name))

    def send_mail(self,sendto,copyto, blindcopyto,subject, body_text, attach):
        doc = self.db.CREATEDOCUMENT