Ok. I have requested and now received a newer version of the OCX
control (from the vendors) that DOES work with VBScript when executed
from wscript/cscript. The PortOpen property now responds correctly
without getting the aforementioned error - and this is a definite
improvement.
However, 2 things still elude me.
1) I wish to be able to use the events available in the object as well,
and after much reading (and purchasing of your book, Mark - which
helped ALOT in several other areas - thank you!) I was left feeling a
bit lost in the 'events' arena. Here is the code I am attempting (short
and simple) atm, which responds with "AttributeError:
'<win32com.client.COMEventClass instance at 0x12436112>' object has no
attribute '_typelib_guid_'":
################## Code snippet [start]
from win32com.client import DispatchWithEvents
class SwiperEvents(object):
def OnCardDataChanged(self,
Source=pythoncom.Missing,
CursorType=pythoncom.Missing,
LockType=pythoncom.Missing,
Options=pythoncom.Missing,
adStatus=pythoncom.Missing,
pCommand=pythoncom.Missing,
pRecordset=pythoncom.Missing,
pConnection=pythoncom.Missing):
print "Handler called!"
swiper = DispatchWithEvents('ctlUSBHID.USBHID', SwiperEvents)
################## Code snippet [end]
I have a bad feeling this is an obvious error on my part - but am still
too new at Python I guess.
2) (and this is probably related to the first thing) - when I monitor
the CardData property for changes 'manually' (with a loop) it never
changes - no matter how many card swipes I attempt. COULD this be a
result of the PortOpen property not actually making the necessary
connection in the OCX and just 'acting' like it was set?:
__________________________
Garth Johnson
PS Oh - and I DID fully remove the old OCX AND the Makepy output before
rebuilding it - and tested for the correct version of the control from
wscript with vbscript test code they sent me (which looks essentially
the same as the web page one).
_______________________________________________
Python-win32 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-win32