Pythonwin com?

Sam Schulenburg samschul at pacbell.net
Thu May 11 19:40:46 EDT 2000


I have been trying to unravel the secrets of COM from Python! A few
weeks ago I asked the following question and was able to solve the
problem:

Given the following VB script how do I get it to work under Python:
DIM Frame as Variant ' Setup an array
DIM dx as DocFile    ' Get a DocFile Object
DIM ex as NEW ExpSetup ' Get a ExpSetup Object
DIM bRes as Integer
    ex.Start(dx)         ' Do Experment
    dx.GetFrame 1,Frame  ' Get The Data array
    ----  Modify Frame ----
    dx.PutFrame 1,Frame  ' Put the data back

The following Python code Python code works:
ex = win32com.client.Dispatch(Winx32App.CLSID)
dx = win32com.client.Dispatch(DocFile.CLSID)
Frame = {}   # Here I have to set Frame up as a tuple

ex.Start(dx) # Do experment, This works
# This now works returning a tuple Array in Buff
Buff = dx.GetFrame(1,Frame)
# This does not work, I can not return the data
dx.PutFrame(1,Buff)

It appears that the data type returned is not compatable with the data
type required for the PutFrame() function. The following definitions
are returned in the Makepy file:

def GetFrame(self,
             frame=defaultNamedNotOptArg,
             FrameVariant=defaultNamedNotOptArg):
		"""Get Frame Data"""
return self._ApplyTypes_(0xa,
                           1,
                     (24, 0),
        ((2, 1), (16396, 3)),
                  'GetFrame',
                        None,
                       frame,
                FrameVariant)


def PutFrame(self,
             frame=defaultNamedNotOptArg,
             FrameArray=defaultNamedNotOptArg):
		"""Put Frame Data"""
return self._ApplyTypes_(0xb,
                           1,
                     (24, 0),
        ((2, 1), (16396, 3)),
                  'PutFrame',
                        None,
                       frame,
                  FrameArray)

Any ideas would be appreciated
Sam Schulenburg


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list