| |
|
|
| for the Barcode-Scanner BCP5000 have I the subesquent choose-View source manufactured z.B. for on-/ Integration on Firmensoftware. the Program reads whom Scanner from and writes The data in a Textdatei and "löscht" whom Scanner. there's too The ausgeklammerte Function to The Datensätze in a Listbox To copy.
Thank you too on Michael jar ( [...] ) for Steuerbefehle - with it can too these Scanner order.
the Program was/ is necessary since the mitgelieferte Auslesesoftware (naturally) not funktionierte - "natürlich" was one OCX or a Komponente "ungültig".
Barcodes print goes herewith integrally simply: [...] CompileMarkSeparation {$cleq}
{$runtime C:\dev\BCP5000\}
const outpFle="bcp5000output.txt"
/*
// Liste-Variante
long dataSet=bcp5000.createScannedDataList(4)
case dataSet==-1 : end messageBox("Scanner-Fehler.","Scanner-Fehler.",4096)
print "DataSets:",getCount(dataSet)
whileLoop 0,getCount(dataSet)-1
print getString$(dataSet,loop)
wend
*/
long comPort=val(readini$(progDir+"bcp5000.ini","setup","port"))
if comPort<1
writeini progDir+"bcp5000.ini","setup","port"="0"
shell "notepad "+progDir+"bcp5000.ini"
end
endif
long fh=assign(outpFle)
casenot fh : end messageBox(outpFle+"-Fehler","Fehler.",4096)
if fileExists(outpFle)
append fh
else
rewrite fh
endif
case ioResult : end messageBox(outpFle+"-Fehler","Fehler.",4096)
string dta=bcp5000.createScannedDataList(comPort,false)
caseNot dta=="" : print #fh,dta
close fh
bcp5000.eraseData(comPort)
end
proc bcp5000.eraseData(long comPortNumber)
long h=openCom("COM"+str$(comPortNumber),262144,262144)
case h<1 : return -1//end messageBox("Scanner nicht gefunden.","Scanner nicht gefunden.",4096)
casenot setCom(h,"COM"+str$(comPortNumber)+":19200,N,8,1")==0 : return -1//end messageBox("Scanner-SetCom-Fehler.","Scanner-SetCom-Fehler.",4096)
writeCom(h,"\x02 E\x0D\x72\x03")
caseNot comError(h)==0 : return -1//end messageBox("Scanner-WriteCom-Fehler.","Scanner-WriteCom-Fehler.",4096)
closeCom(h)
return 1
endProc
proc bcp5000.createScannedDataList(long comPortNumber,bool stringOrList)
case pCount<2 : stringOrList=true
long h=openCom("COM"+str$(comPortNumber),262144,262144)
case h<1 : return -1//end messageBox("Scanner nicht gefunden.","Scanner nicht gefunden.",4096)
casenot setCom(h,"COM"+str$(comPortNumber)+":19200,N,8,1")==0 : return -1//end messageBox("Scanner-SetCom-Fehler.","Scanner-SetCom-Fehler.",4096)
writeCom(h,"\x02 D\x0D\x71\x03")
caseNot comError(h)==0 : return -1//end messageBox("Scanner-WriteCom-Fehler.","Scanner-WriteCom-Fehler.",4096)
string s
long tme=getTickCount+15000
while getTickCount<tme
s=readCom$(h,262144)
// caseNot comError(h)==0 : return -4 //end messageBox("Scanner-ReadCom-Fehler.","Scanner-ReadCom-Fehler.",4096)
caseNot s=="" : break
sleep 100
wend
long scanC=int(val(mid$(s,10,5))),ofs=15,lst
string dte,dta,ns,scid=mid$(s,2,8)
case stringOrList : lst=create("list",0)
whileLoop scanC
dte=format$("00",str$(ord(mid$(s,2+ofs,1))-16))+"."+format$("00",str$(ord(mid$(s,1+ofs,1))-16))+"."+"20"+format$("00",str$(ord(mid$(s,ofs,1))-16))+" "+format$("00",str$(ord(mid$(s,3+ofs,1))-16))+":"+format$("00",str$(ord(mid$(s,4+ofs,1))-16))+":"+format$("00",str$(ord(mid$(s,5+ofs,1))-16))
ns=scid+" "+dte+" "
inc ofs,7
whileNot mid$(s,ofs,1)==","
ns=ns+mid$(s,ofs,1)
inc ofs,1
wend
if stringOrList
addstring(lst,ns)
else
dta=dta+ns+"\n"
endif
inc ofs,2
wend
closeCom(h)
case stringOrList : return lst
return trim$(endProc
|
|
|
| |
|
|