try to write a simple program to read barcode on win7 pc
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
try to write a simple program to read barcode on win7 pc
I want to start using livecode to write the simple program to read normal barcode using USB barcode reader and put them in a database for attendance application.
please give me some direction or sample how do I start something like this.
if there is something like this available, can let me know and I don't mind to learn and modify the code to fit my need.
thanks.
please give me some direction or sample how do I start something like this.
if there is something like this available, can let me know and I don't mind to learn and modify the code to fit my need.
thanks.
Re: try to write a simple program to read barcode on win7 pc
Most barcode readers come with the software for reading. All you have to do, is have focus for the field in which you want the numbers to show and activate the scanner.
Re: try to write a simple program to read barcode on win7 pc
Easy.
First : set up your reader
-> start with...no special parameters
Second : barcode choice ?
Code 128 or 39 ?
-> start with a regular Code 39
It's the easiest.
Third : the principle
-> add prefix and suffix to your bacoded data :
For instance : *+MYDATA$*
(the "*" is the official delimiter for code 39)
Then in the script of a card with one field, something like this
-scan the barcode
-data will be decoded as keyboard stroke, hence the message keyDown
-the script is looking for your special prefix and suffix
That's the easiest way, if you have the control over the data your print with barcodes.
Other ways are possible involving settings on the reader itself (with most of readers, you can set special suffix and/or prefix directly), when you can't modify the data.
First : set up your reader
-> start with...no special parameters
Second : barcode choice ?
Code 128 or 39 ?
-> start with a regular Code 39
It's the easiest.
Third : the principle
-> add prefix and suffix to your bacoded data :
For instance : *+MYDATA$*
(the "*" is the official delimiter for code 39)
Then in the script of a card with one field, something like this
Code: Select all
global gReadBC
on keyDown theKey
if thekey is "+" then
put empty into field "decodedData"
put 2 into gReadBC
exit keydown
end if
if gReadBC=2 then
put theKey after field "decodedData"
end if
if thekey is "$" and gReadBC=2 then
put 1 into lectureBC
delete last char of field "decodedData"
manageData
exit to top
end if
end keyDown
on manageData
---- this script will be executed when the reading of the barcode is finished
------ here you can write the data to your database etc.
end manageData
-data will be decoded as keyboard stroke, hence the message keyDown
-the script is looking for your special prefix and suffix
That's the easiest way, if you have the control over the data your print with barcodes.
Other ways are possible involving settings on the reader itself (with most of readers, you can set special suffix and/or prefix directly), when you can't modify the data.
Re: try to write a simple program to read barcode on win7 pc
Try this in card script:
took it from sample stack and added double barcode detection...
Code: Select all
global tBarcode, tBarcodevergleich
-- this routine reads the barcode
-- one character at a time
--
on keyDown theKey
if the hilite of btn "Pause" = false then
put theKey after fld "Barcodes"
else
pass keyDown
end if
end keyDown
-- this routine looks for the barcodes end of line character
-- in this tester, it just adds a linefeed
-- but in a real application, this is where
-- you would handle the barcode information
--
on rawKeyDown theKey
global tSecs
if the hilite of btn "Show raw data" = false then
if theKey = 65293 and the hilite of btn "Pause"=false then
-- 65293 is das enterZeichen vom Scanner--end of line char from scanner
if tSecs +5 > the seconds then
put empty into fld "Barcodes"
exit to top
end if
if fld "Barcodes" is empty then exit to top
checkBarcodes#check for double barcodes
put the seconds into tSecs
put empty into fld "Barcodes"
else
pass rawKeyDown
end if
else
#ab hier werden rawkeys erfasst wenns häckchen steht--rawkey detection
put theKey & cr after fld "Barcodes"
end if
end rawKeyDown
on checkBarcodes
repeat for each line tLine in fld "Barcodes"
if tLine is among the lines of tBarcode then
beep
put empty into fld "Barcodes"
set the visible of fld "lblFlash" to true
set the uFlash of fld "lblFlash" to true
set the uFlashRepeat of fld "lblFlash" to 10
send "flash" to fld "lblFlash"
else
put fld "Barcodes"&cr after tBarcode
set the uFlash of fld "lblFlash" to false
set the visible of fld "lblFlash" to false
Scan#Scan Barcode
end if
end repeat
end checkBarcodes
the funniest thing about this particular signature is that by the time you realize it doesn't say anything it's too late to stop reading it
Re: try to write a simple program to read barcode on win7 pc
Sorry that I am really the beginning in this program, how to put the sample script that you mention into the card. You can send me the link for me to learn the process too.
My whole idea is to use this program for the church fellowship to take the attendance of the children that come to the class, at what time they come in, and also read the barcode again when they are checking out, put all this into a report or export to excel for anyone to use after ward.
if possible, I also want to put this into a simple database, as you know the student might move from 1 class to another.
thanks.
My whole idea is to use this program for the church fellowship to take the attendance of the children that come to the class, at what time they come in, and also read the barcode again when they are checking out, put all this into a report or export to excel for anyone to use after ward.
if possible, I also want to put this into a simple database, as you know the student might move from 1 class to another.
thanks.
Re: try to write a simple program to read barcode on win7 pc
Hey
I think this link might sort out some problems for you:
http://livecodesupersite.com/tutorials.html
There you can find How to use database, working with fields and Export Text to CSV.
Good luck!
I think this link might sort out some problems for you:
http://livecodesupersite.com/tutorials.html
There you can find How to use database, working with fields and Export Text to CSV.
Good luck!
the funniest thing about this particular signature is that by the time you realize it doesn't say anything it's too late to stop reading it