'----****
'----**** MyBusiness POS V20
'----**** Version del script: 1.0
'----**** 19/02/2020
'----****
Public Sub Main()
' Si la mauiquina pide configurar el puerto
if Ambiente.Tag = "CONFIGURANDO" Then
Configuracion
else
ProcesaCodigo
end if
End Sub
Public Sub Configuracion()
if Ambiente.Lector.PortOpen Then
Ambiente.Lector.PortOpen = False
end if
Select Case Trim(Ambiente.rstEstacion("pbascula"))
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
Ambiente.Lector.CommPort = 1
End Select
if Ambiente.Lector.PortOpen Then
Exit Sub
end if
Ambiente.Tag = ""
Ambiente.Lector.Settings = "9600,O,7,1"
Ambiente.Lector.RTSEnable = True
Ambiente.Lector.PortOpen = True
TimerLector.Enabled = True
Exit Sub
End Sub
Public Sub ProcesaCodigo
' Si el puerto no esta abierto salimos del procedimiento
if Ambiente.Lector.PortOpen = False Then
Exit Sub
end if
flujo = flujo & Ambiente.Lector.Input
if clAt("S11", flujo ) Then
flujo = ""
end if
if Len(flujo) >= 16 Then
if Mid( flujo, 1, 3) = "S08" Then
Select Case Mid( flujo, 1, 4)
Case "S085"
Teclado.SendKeys ( Mid( flujo,5 ) )
flujo = ""
Case "S08A"
Teclado.SendKeys ( Mid( flujo,5 ) )
flujo = ""
Case "S08F"
if Mid( a,5,1 ) = "F" Then
Teclado.SendKeys ( Mid( flujo,6 ) )
flujo = ""
else
Teclado.SendKeys ( Mid( flujo,5 ) )
flujo = ""
end if
End Select
end if
End If
End Sub
Relacionado