cancel
Showing results for 
Search instead for 
Did you mean: 

Reading Barcodes

Polly_Muehleman
Champ on-the-rise
Champ on-the-rise

I am trying to use barcode scanning to read barcodes.  I have the option of including astrisks in the barcode or not.  The script does not seem to be functioning either way.  Currently I have the barcode setup as *0000956,263333333* and use the following vbscript to process the barcode.  I get only blank pages when I scan the document in. 

Sub BCMain
 
 ' copy the barcode value into a variable we can work with
 Dim barvalue
 barvalue = Barcode.BarcodeValue
 
 ' The barcode value is <doc type name>, < account number  keyword>  separated by a comma
 
 Dim strDocTypeNo
 Dim strAcctNo
 
 
 Dim nFirstComma
 
 
 nFirstComma = InStr (barvalue, " ")
 
 
 ' the doc type number is from the start of the string up to the first comma
 strDocTypeNo = Mid (barvalue, 1, nFirstComma - 1)
 
 
 ' and the Account Number keyword is from the last comma to the end
 strAcctNo = Mid (barvalue, nFirstComma + 1)
 
 ' set the document type ID value for the document
 Barcode.DocumentTypeID = strDocTypeNo
 
 
 'set the first keyword value into the '#-Account' keytype
 Barcode.SetKeywordByID 51, strAcctNo
 

 

Any ideas?  I have read many of the posts and tried various suggestions to no avail.

4 REPLIES 4

Ryan_Nordlocken
Champ in-the-making
Champ in-the-making

It doesn't look like you are seperating anything within your nFirstComma variable.  You should add a comma between your quotes, it looks like its trying to find the first space in the string.

It is also helpful to add message boxes so you can see the values that your variables have throughout the process.

Thanks, I'll check that. 

Ryan,

   Thanks for your help!  Can you let me know how I would display the variable for troubleshooting?  I tried to use document.write and it did not like that. 

 

Thanks,

Polly

Ryan_Nordlocken
Champ in-the-making
Champ in-the-making

Hi Polly,

Use MsgBox.  Below is an example of a script that is similar to yours with a message box at the end to display all of the variables for that barcode.  It can be helpful to put multiple message boxes through the script to verify you have the values you want along the way.

Sub BCMain
 dim barvalue
 dim strDocTypeName
 dim strDocDescription
 dim strKeywordType
 dim a
 dim mrn
 dim csn
 dim bartype
 ' copy the barcode value into a variable we can work with
 ' The barcode value is from adt label
 barvalue = Barcode.BarcodeValue
 bartype = InStr(barvalue,",")
 If bartype = 0 Then
 ' set the barcode value into an array
 ' split the barvalue item into two strings
 ' first value in array is the csn and second is mrn
 Else
 a = split(barvalue,",")
 csn = a(0)
 mrn = a(1)
Barcode.SetKeywordByName "MRN",mrn
Barcode.SetKeywordByName "CSN",csn
 End If
 MsgBox "Barcode Value is: " & barvalue & " Total Length is: " & CStr(Len(barvalue)) _
  & ".  Barcode Doc Type: " & strDocTypeName & ". Barcode Doc Description: " _
   & strDocDescription & csn & mrn &"."
End Sub

Getting started

Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.