Publicado el Dejar un comentario

TUPPERLECTOR Lector especial para codigos de Tupperware

'----**** 
'----**** MyBusiness POS V20
'----**** Version del script: 1.0
'----**** 19/02/2020
'----**** 
Public Sub Main()

    if Ambiente.Tag = "CONFIGURANDO" Then
       ConfiguraPuerto
    else
       ProcesaString
    end if


End Sub


Public Sub ProcesaString()
    Dim a
    Dim b  
 

    For n = 1 To Ambiente.Lector.InBufferCount 
        Tag = Tag & Ambiente.Lector.Input
    Next

    if Len( Tag ) > 5 Then
       
       if clAt( "04", Tag ) = 1 Then
          if Len( Tag ) >= 10 Then
             Tag = Replace( Tag, "04", "D", 1, 1 )
             Tag = Mid( Tag, 1, Len(Tag) - 3 )
             Teclado.SendKeys (Tag) & Chr(13)
             Tag = ""
          end if         
       else
          Teclado.SendKeys (Tag)
          Tag = ""
          Exit Sub 
       end if 
    
    end if   

    
End Sub


Public Sub ConfiguraPuerto()

       if Ambiente.Lector.PortOpen Then
          Ambiente.Lector.PortOpen = False       
       end if 

       Select Case Trim(Ambiente.rstEstacion("plector"))
               Case "COM1"
                   Ambiente.Lector.CommPort = 1
               Case "COM2"  
                   Ambiente.Lector.CommPort = 2
               Case "COM3"  
                   Ambiente.Lector.CommPort = 3
               Case "COM4"  
                   Ambiente.Lector.CommPort = 4
               Case "COM5"  
                   Ambiente.Lector.CommPort = 5            
               Case else
                   Exit Sub
        End Select

        if Ambiente.Lector.PortOpen Then
           Exit Sub
        end if 

        Ambiente.Lector.Settings = "9600,N,8,1"
        Ambiente.Lector.RTSEnable = True    
        Ambiente.Lector.PortOpen = True

        TimerLector.Enabled = True
        Ambiente.Tag = ""

End Sub
Deja un comentario