OT - convert VB code to Python

Werner F. Bruhin werner.bruhin at free.fr
Fri Sep 15 03:26:04 PDT 2006


Sorry for this OT post.

The following VB code is used to generated a unique ID for an item to be 
able to exchange between different systems.  I think one could do this 
much simpler, but this is in use so it has to be done this way.

I don't know anything about VB, so I hope there is a kind soul here who 
knows VB and could help me with converting this code to Python.

Sub Convert2Bin()

  Dim Y As Long

  With fp
    Y = Year(.Datum) - 1980
    fpbin.FP1 = (Y * (2& ^ 20)) + _
                (Month(.Datum) * (2 ^ 16)) + _
                (Day(.Datum) * (2 ^ 11)) + _
                (Hour(.Datum) * (2 ^ 6)) + _
                Minute(.Datum)
    fpbin.FP2 = ((.CreatorID And &H7FF) * (2& ^ 20)) + _
                (.Counter And &HFFFFF)
    If .CreatorID > 2047 Then fpbin.FP2 = -fpbin.FP2
  End With

End Sub

Thanks in advance
Werner





More information about the wxpython-users mailing list