Ok, I am still relatively new to python, but have chosen it as the 
language to write a project in. 

I have searched, googled and bought every O'Reilly book I can find.. and 
am still stumped.  I turn to your venerable forum of knowledge for 
assistance.

The project uses a piece of USB HID hardware that scans the swipe strip 
on credit cards and allows tracking, accounting etc for various 
purposes.  The device I am using at the moment comes from MagTek and 
they supplied me with an OCX/ActiveX/COM control that their demo uses in 
a vbscript (IE only) web page.  While this is just dandy, I need a more 
direct access method for a local instance in my project.

I used the MakePy.py tool, and did the expected  - added it to the 
Lib\site-packages\win32com\gen_py pile of supported COM components.

Here is the result of me attempting to use it manually in PyWin...

 >>> import win32com.client
 >>> swipe = win32com.client.Dispatch("ctlUSBHID.USBHID")
 >>> swipe.PortOpen
False
 >>> swipe.PortOpen = True
Traceback (most recent call last):
  File "<interactive input>", line 1, in ?
  File "C:\Python24\Lib\site-packages\win32com\client\__init__.py", line 
463, in __setattr__
    self._oleobj_.Invoke(*(args + (value,) + defArgs))
com_error: (-2147352567, 'Exception occurred.', (0, 'ctlUSBHID', 'Client 
Site not available', None, 1000398, -2146827890), None)
 >>>

The same process works fin in VBScript on the example page from 
MagTek..  The generated py code from MakePy.py has

    _prop_map_get_ = {
        "CardData": (1745027073, 2, (8, 0), (), "CardData", None),
        "CardEncodeType": (1745027082, 2, (8, 0), (), "CardEncodeType", 
None),
        "DeviceSerialNum": (1745027083, 2, (8, 0), (), 
"DeviceSerialNum", None),
        "MPrintData": (1745027086, 2, (12, 0), (), "MPrintData", None),
        "MPrintLen": (1745027087, 2, (3, 0), (), "MPrintLen", None),
        "MPrintStatus": (1745027084, 2, (3, 0), (), "MPrintStatus", None),
        "PortOpen": (1745027072, 2, (11, 0), (), "PortOpen", None),
        "SequenceNumber": (1745027085, 2, (3, 0), (), "SequenceNumber", 
None),
    }
    _prop_map_put_ = {
        "CardData": ((1745027073, LCID, 4, 0),()),
        "CardEncodeType": ((1745027082, LCID, 4, 0),()),
        "DeviceSerialNum": ((1745027083, LCID, 4, 0),()),
        "MPrintData": ((1745027086, LCID, 4, 0),()),
        "MPrintLen": ((1745027087, LCID, 4, 0),()),
        "MPrintStatus": ((1745027084, LCID, 4, 0),()),
        "PortOpen": ((1745027072, LCID, 4, 0),()),
        "SequenceNumber": ((1745027085, LCID, 4, 0),()),
    }

What am I doing wrong.?  ..or is it something wrong in the COM control 
itself?
_______________________________________________
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to