• Sábado 27 de Abril de 2024, 06:51

Autor Tema:  Como Leer Un Codigo De Barra  (Leído 7160 veces)

_EL_DJ_LU

  • Miembro activo
  • **
  • Mensajes: 78
    • Ver Perfil
Como Leer Un Codigo De Barra
« en: Martes 6 de Enero de 2004, 20:13 »
0
Hola a todos.... muchas gracias por la ayuda que siempre me dan... gracias de verdad..

Ahora tengo un problema...  quiero saber como puedo leer una barra de codigo ...


Dentro de poco comprare una lectora de barra de codigo... pero como puedo hacer para que lo que leea lo ponga en un control "text" por ejemplo....

Algo parecido a codigo de productos de una tienda.. me entienden no??/

Espero que si... pero yo lo quero usar para leer tarjetas de identificacion estas tienen un codigo de barra ... muchas gracias....


gracias....

Cyclop

  • Miembro MUY activo
  • ***
  • Mensajes: 323
    • Ver Perfil
    • http://www.geocities.com/icotext/spanish/
Re: Como Leer Un Codigo De Barra
« Respuesta #1 en: Martes 6 de Enero de 2004, 23:02 »
0
Las lectoras de codigo de barra funcionan como el teclado, si el cursor esta en un textbox, y lees un codigo de barra, automaticamente los datos van a aparecer en el textbox como si lo ubiera ingresado por el teclado, mejor dicho la lectora convierte el codigo de barra en pulsasiones de teclas.


Salu2
Icotext Evolution v0.5 para los amantes del ASCII Art
http]

_EL_DJ_LU

  • Miembro activo
  • **
  • Mensajes: 78
    • Ver Perfil
Re: Como Leer Un Codigo De Barra
« Respuesta #2 en: Jueves 8 de Enero de 2004, 04:24 »
0
Gracias por la respuesta... con eso creo que me quedo claro esa parte... muchas gracias...ahora solo me falta prebar eso.. pero no te preocupes comprare dicha lectora y lo probare...


Ahora tengo otra duda... yo quiero dise;ar esas tarjetas de identificacion para cada usuario.. para esto yo tengo que imprimir los codigos de barra...

Me podrian decir como puedo hacer esto???? donde consigo la fuente de codigo de barras... muchas gracias.....


Muchas gracias ahora si con esto avanzo con mi programa... gracias.. gracias..



_EL_DJ_LU

Cyclop

  • Miembro MUY activo
  • ***
  • Mensajes: 323
    • Ver Perfil
    • http://www.geocities.com/icotext/spanish/
Re: Como Leer Un Codigo De Barra
« Respuesta #3 en: Jueves 8 de Enero de 2004, 13:50 »
0
Uno puede ser que te bajes unas fuentes true type de codigo de barra y lo insertes en tus reportes, para mayor explicacion revisa esta pagina, yo vi un ejemplo con Visual Foxpro.

http://www.idautomation.com/

http://www.idautomation.com/sitemap/visual...rcodeFontModule


Salu2
El mensaje contiene 1 archivo adjunto. Debes ingresar o registrarte para poder verlo y descargarlo.
Icotext Evolution v0.5 para los amantes del ASCII Art
http]

Cyclop

  • Miembro MUY activo
  • ***
  • Mensajes: 323
    • Ver Perfil
    • http://www.geocities.com/icotext/spanish/
Re: Como Leer Un Codigo De Barra
« Respuesta #4 en: Jueves 8 de Enero de 2004, 14:04 »
0
En Visual Foxpro funciona algo asi

Tienes un label y quieres que ahi te muestre un codigo de barras, entonces en la propiedad font le indicas el tipo de fuente de codigo de barras (Ej. Micodebar.ttf), pero ahi no termina todo, para que la lectura pueda interpretar lo tienes que codificar, por ejeplo vas a utilizar el cdigo 128c, usas la funcion Code128

que hace esto, converte el codigo del productor en una cadena para impresion de codigo de barras

Tu codigo
01081995JUAN32

Cadena de codigo de barra
Í!(3ÃÈJUAN32fÎ

Las lectoras solo te podran leer las cadenas de codigo de barra y te retornan, tu codigo de material o lo que fuere.

Espero que esto te ayude

Salu2

Código: Text
  1.  
  2. Public Function Code128(DataToFormat As String, ReturnType As Integer) As String
  3. '
  4. ' Copyright © IDautomation.com, Inc. 2001.  All rights reserved.
  5. ' For more info visit http://www.IDAutomation.com
  6. '
  7. ' You may use our source code in your applications only if you are using barcode fonts created by IDautomation.com, Inc.
  8. ' and you do not remove the copyright notices in the source code.
  9. '
  10. ' The purpose of this code is to calculate the Code 128 barcode for ANY character set
  11. '
  12. ' Encode UCC/EAN 128 by inserting ASCII 202 into the string to encode
  13. '
  14. ' You MUST use the fully functional Code 128 (dated 12/2000 or later)
  15. ' font for this code to create and print a proper barcode
  16. '
  17.     DataToPrint = ""
  18.     DataToFormat = RTrim(LTrim(DataToFormat))
  19.     C128_StartA = Chr(203)
  20.     C128_StartB = Chr(204)
  21.     C128_StartC = Chr(205)
  22.     C128_Stop = Chr(206)
  23. 'Here we select character set A, B or C for the START character
  24.     StringLength = Len(DataToFormat)
  25.     CurrentCharNum = Asc(Mid(DataToFormat, 1, 1))
  26.     If CurrentCharNum < 32 Then C128Start = C128_StartA
  27.     If CurrentCharNum > 31 And CurrentCharNum < 127 Then C128Start = C128_StartB
  28.     If ((StringLength > 4) And IsNumeric(Mid(DataToFormat, 1, 4))) Then C128Start = C128_StartC
  29. '202 is the FNC1, with this Start C is mandatory
  30.     If CurrentCharNum = 202 Then C128Start = C128_StartC
  31.     If C128Start = Chr(203) Then CurrentEncoding = "A"
  32.     If C128Start = Chr(204) Then CurrentEncoding = "B"
  33.     If C128Start = Chr(205) Then CurrentEncoding = "C"
  34.     For I = 1 To StringLength
  35.     'check for FNC1 in any set
  36.         If ((Mid(DataToFormat, I, 1)) = Chr(202)) Then
  37.             DataToEncode = DataToEncode & Chr(202)
  38.     'check for switching to character set C
  39.         ElseIf ((I < StringLength - 2) And (IsNumeric(Mid(DataToFormat, I, 1))) And (IsNumeric(Mid(DataToFormat, I + 1, 1))) And (IsNumeric(Mid(DataToFormat, I, 4)))) Or ((I < StringLength) And (IsNumeric(Mid(DataToFormat, I, 1))) And (IsNumeric(Mid(DataToFormat, I + 1, 1))) And (CurrentEncoding = "C")) Then
  40.         'switch to set C if not already in it
  41.             If CurrentEncoding <> "C" Then DataToEncode = DataToEncode & Chr(199)
  42.             CurrentEncoding = "C"
  43.             CurrentChar = (Mid(DataToFormat, I, 2))
  44.             CurrentValue = CInt(CurrentChar)
  45.         'set the CurrentValue to the number of String CurrentChar
  46.             If (CurrentValue < 95 And CurrentValue > 0) Then DataToEncode = DataToEncode & Chr(CurrentValue + 32)
  47.             If CurrentValue > 94 Then DataToEncode = DataToEncode & Chr(CurrentValue + 100)
  48.             If CurrentValue = 0 Then DataToEncode = DataToEncode & Chr(194)
  49.             I = I + 1
  50.     'check for switching to character set A
  51.         ElseIf (I <= StringLength) And ((Asc(Mid(DataToFormat, I, 1)) < 31) Or ((CurrentEncoding = "A") And (Asc(Mid(DataToFormat, I, 1)) > 32 And (Asc(Mid(DataToFormat, I, 1))) < 96))) Then
  52.         'switch to set A if not already in it
  53.             If CurrentEncoding <> "A" Then DataToEncode = DataToEncode & Chr(201)
  54.             CurrentEncoding = "A"
  55.         'Get the ASCII value of the next character
  56.             CurrentCharNum = (Asc(Mid(DataToFormat, I, 1)))
  57.             If CurrentCharNum = 32 Then
  58.                 DataToEncode = DataToEncode & Chr(194)
  59.             ElseIf CurrentCharNum < 32 Then
  60.                 DataToEncode = DataToEncode & Chr(CurrentCharNum + 96)
  61.             ElseIf CurrentCharNum > 32 Then
  62.                 DataToEncode = DataToEncode & Chr(CurrentCharNum)
  63.             End If
  64.     'check for switching to character set B
  65.         ElseIf (I <= StringLength) And ((Asc(Mid(DataToFormat, I, 1))) > 31 And (Asc(Mid(DataToFormat, I, 1)))) < 127 Then
  66.         'switch to set B if not already in it
  67.             If CurrentEncoding <> "B" Then DataToEncode = DataToEncode & Chr(200)
  68.             CurrentEncoding = "B"
  69.         'Get the ASCII value of the next character
  70.             CurrentCharNum = (Asc(Mid(DataToFormat, I, 1)))
  71.             If CurrentCharNum = 32 Then
  72.                 DataToEncode = DataToEncode & Chr(194)
  73.             Else
  74.                 DataToEncode = DataToEncode & Chr(CurrentCharNum)
  75.             End If
  76.         End If
  77.     Next I
  78.    
  79.     HumanReadableText = ""
  80. 'FORMAT TEXT FOR AIs
  81.     StringLength = Len(DataToFormat)
  82.     For I = 1 To StringLength
  83.     'Get ASCII value of each character
  84.         CurrentCharNum = Asc(Mid(DataToFormat, I, 1))
  85.     'Check for FNC1
  86.         If ((I < StringLength - 2) And (CurrentCharNum = 202)) Then
  87.         'It appears that there is an AI
  88.         'Get the value of each number pair (ex: 5 and 6 = 5*10+6 =56)
  89.             CurrentChar = (Mid(DataToFormat, I + 1, 2))
  90.             CurrentCharNum = CInt(CurrentChar)
  91.         'Is 4 digit AI?
  92.             If ((I < StringLength - 4) And ((CurrentCharNum <= 81 And CurrentCharNum >= 80) Or (CurrentCharNum <= 34 And CurrentCharNum >= 31))) Then
  93.                 HumanReadableText = HumanReadableText & " (" & (Mid(DataToFormat, I + 1, 4)) & ") "
  94.                 I = I + 4
  95.         'Is 3 digit AI?
  96.             ElseIf ((I < StringLength - 3) And ((CurrentCharNum <= 49 And CurrentCharNum >= 40) Or (CurrentCharNum <= 25 And CurrentCharNum >= 23))) Then
  97.                 HumanReadableText = HumanReadableText & " (" & (Mid(DataToFormat, I + 1, 3)) & ") "
  98.                 I = I + 3
  99.         'Is 2 digit AI?
  100.             ElseIf ((CurrentCharNum <= 30 And CurrentCharNum >= 0) Or (CurrentCharNum <= 99 And CurrentCharNum >= 90)) Then
  101.                 HumanReadableText = HumanReadableText & " (" & (Mid(DataToFormat, I + 1, 2)) & ") "
  102.                 I = I + 2
  103.             End If
  104.         ElseIf (Asc(Mid(DataToFormat, I, 1)) < 32) Then
  105.             HumanReadableText = HumanReadableText & " "
  106.         ElseIf ((Asc(Mid(DataToFormat, I, 1)) > 31) And (Asc(Mid(DataToFormat, I, 1)) < 128)) Then
  107.             HumanReadableText = HumanReadableText & Mid(DataToFormat, I, 1)
  108.         End If
  109.     Next I
  110.     DataToFormat = ""
  111.    
  112. '<<<< Calculate Modulo 103 Check Digit >>>>
  113. 'Set WeightedTotal to the value of the start character
  114.     weightedTotal = (Asc(C128Start) - 100)
  115.     StringLength = Len(DataToEncode)
  116.     For I = 1 To StringLength
  117.     'Get the ASCII value of each character
  118.         CurrentCharNum = (Asc(Mid(DataToEncode, I, 1)))
  119.     'Get the Code 128 value of CurrentChar according to chart
  120.         If CurrentCharNum < 135 Then CurrentValue = CurrentCharNum - 32
  121.         If CurrentCharNum > 134 Then CurrentValue = CurrentCharNum - 100
  122.         If CurrentCharNum = 194 Then CurrentValue = 0
  123.     'multiply by the weighting character
  124.         CurrentValue = CurrentValue * I
  125.     'add the values together
  126.         weightedTotal = weightedTotal + CurrentValue
  127.     Next I
  128. 'divide the WeightedTotal by 103 and get the remainder, this is the CheckDigitValue
  129.     CheckDigitValue = (weightedTotal Mod 103)
  130. 'Now that we have the CheckDigitValue, find the corresponding ASCII character from the table
  131.     If CheckDigitValue < 95 And CheckDigitValue > 0 Then C128_CheckDigit = Chr(CheckDigitValue + 32)
  132.     If CheckDigitValue > 94 Then C128_CheckDigit = Chr(CheckDigitValue + 100)
  133.     If CheckDigitValue = 0 Then C128_CheckDigit = Chr(194)
  134. 'Check for spaces or "00" and print ASCII 194 instead
  135. 'place changes in DataToPrint
  136.     StringLength = Len(DataToEncode)
  137.     For I = 1 To StringLength
  138.         CurrentChar = Mid(DataToEncode, I, 1)
  139.         If CurrentChar = " " Then CurrentChar = Chr(194)
  140.         DataToPrint = DataToPrint & CurrentChar
  141.     Next I
  142. 'Get Printable String
  143.     Printable_string = C128Start & DataToPrint & C128_CheckDigit & C128_Stop & " "
  144.     DataToEncode = ""
  145.     DataToPrint = ""
  146. 'ReturnType 0 returns data formatted to the barcode font
  147.     If ReturnType = 0 Then Code128 = Printable_string
  148. 'ReturnType 1 returns data formatted for human readable text
  149.     If ReturnType = 1 Then Code128 = HumanReadableText
  150. 'ReturnType 2 returns the check digit for the data supplied
  151.     If ReturnType = 2 Then Code128 = C128_CheckDigit
  152.    
  153. End Function
  154.  
  155.  
  156.  
Icotext Evolution v0.5 para los amantes del ASCII Art
http]

ebolo

  • Miembro MUY activo
  • ***
  • Mensajes: 188
    • Ver Perfil
Re: Como Leer Un Codigo De Barra
« Respuesta #5 en: Lunes 12 de Enero de 2004, 13:35 »
0
Hola a todos.
Por si todavía lo necesitas, te adjunto un archivo con varias fuentes true type de código de barras, que debes instalar en la carpeta Fonts del windows y directamente podrás usarlas cómo otro tipo de letra más. Es decir, si eliges ese tipo de letra directamente sale el código de barras según escribes.

Si lo que quieres codificar no es muy grande con el code39 tienes bastante, sino deberías usar un code128 ó ean128.

Saludos.
El mensaje contiene 1 archivo adjunto. Debes ingresar o registrarte para poder verlo y descargarlo.

eliza_marti

  • Miembro MUY activo
  • ***
  • Mensajes: 267
    • Ver Perfil
    • http://www.solocodigo.com
Re: Como Leer Un Codigo De Barra
« Respuesta #6 en: Miércoles 7 de Julio de 2004, 18:18 »
0
hola :hola:  :) ....a todos...pero primero compra tu lector de codigo de barras y luego haces tus tarjetas....porque algunos lectores no aceptan todos los tipos de códigos de barra...bye... ;)  :P  :hola:  :comp:
Conserva la Paz con tu Alma en la bulliciosa confusión de la vida, aún con toda su farsa, penalidades y sueños fallidos, el mundo es todavia Hermoso....

http]
programacion,c,c++,
C#,java,linux,videojuegos,
directX,.NET,allegro,asm,codigo
[

eliza_marti

  • Miembro MUY activo
  • ***
  • Mensajes: 267
    • Ver Perfil
    • http://www.solocodigo.com
Re: Como Leer Un Codigo De Barra
« Respuesta #7 en: Miércoles 7 de Julio de 2004, 18:27 »
0
Ah!!!..también...para hacer tus tarjetas.... puedes usar un programa Card Print...te servirá mucho..allí puedes generar automáticamente tus tarjetas, puedes crear primero tu numeración en exel (dependiendo de cuantas tarjetas quieras)..y luego guardarla y llamarla desde el card Print.. y automáticamente se te generará un nuevo código de barras dependiendo de la numeración..pero primero tienes que elegir primero un tipo de código de barra compatible con tu lector no te olvides!..sino trabajarás en vano...lo demás ya está dicho antes..(lo de como funciona el lector)... espero que te pueda servir...bye... ;)  ;)  :P  :lol:  :hola:  :D  :comp:
Conserva la Paz con tu Alma en la bulliciosa confusión de la vida, aún con toda su farsa, penalidades y sueños fallidos, el mundo es todavia Hermoso....

http]
programacion,c,c++,
C#,java,linux,videojuegos,
directX,.NET,allegro,asm,codigo
[

mcrex

  • Nuevo Miembro
  • *
  • Mensajes: 20
    • Ver Perfil
Re: Como Leer Un Codigo De Barra
« Respuesta #8 en: Viernes 9 de Julio de 2004, 14:10 »
0
he descargado estas fuentes UPCA - UPCES ETC. que pone ebolo

Lo que no se es si debo poner una longitud maxima

Además si es usarla como fuente y ya está sin digitos de control