Byte-operations.

Dave Rose photos at conversent.net
Wed May 18 22:20:19 EDT 2005


I hope someone can please help me.  A few months ago, I found a VBS file, 
MonitorEDID.vbs on the internet.  It is great in that it will extract from the 
registry of Windows the serial number of the attached monitor. (System 
Administration / PC Inventory usage is obvious)

Standalone, it works fine. However, I'd like to integrate it with other system 
interrogations via Tim Golden's WMI and Marc Hammonds Win32all to get RAM, HD 
size, CPU, PC Serial Number, etc and to also take that info and toss into a 
lite database, such as KirbyBase.

However, my Python is limited.  I've gotten the first half of the program 
translated (I believe, I haven't done exhaustive testing).

So, the data is stuck in a dictionary.  A clipping is shown here:

{0: '\x00\xff\xff\xff\xff\xff\xff\x00$M\x93!\x01\  <-SNIP-> '}

Anyway, the functions from VBS I don't know how to translate to Python are:

#        location(0)=mid(oRawEDID(i),0x36+1,18)
#        location(1)=mid(oRawEDID(i),0x48+1,18)
#
#        #you can tell if the location contains a serial number if it starts 
with 0x00 00 00 ff
#        strSerFind=chr(0x00) & chr(0x00) & chr(0x00) & chr(0xff)
#
#        #or a model description if it starts with 0x00 00 00 fc
#        strMdlFind=chr(0x00) & chr(0x00) & chr(0x00) & chr(0xfc)


#            #the week of manufacture is stored at EDID offset 0x10
#            tmpmfgweek=ord(mid(oRawEDID(i),0x10+1,1))


#            #store it in month/year format 
#            if tmpEDIDMajorVer < 255-48 and tmpEDIDRev < 255-48 :
#                tmpver=chr(48+tmpEDIDMajorVer) & "." & chr(48+tmpEDIDRev)
#            else:
#                tmpver="Not available"


#            if (Byte1 and 16) > 0:
#                Char1=Char1+4


If someone can help me understand what to do with these types of commands, I'd 
be much appreciative.  Once it's translated, I'd be happy to share this!


Thanks!
Dave





More information about the Python-list mailing list