Sample VB script code : Generating Barcodes dynamically from within FormDocs scripting - Support

Sample VB script code : Generating Barcodes dynamically from within FormDocs scripting

From Support

Jump to: navigation, search

Contents

Installing the RJS Barcode ActiveX for scripting.

Download the RJS Barcode ActiveX Object from RJS Software Systems

Download Barcode ActiveX


Extract the RJS Barcode ActiveX

1. Run the "RJSBARCODEACTIVEX.EXE" that was downloaded in the previous step.

2. Click the "Unzip" button to extract the RJS Barcode ActiveX to C:\WSPEFORM.

3. Click "OK" and "CLOSE" to complete the file Extraction.


Register the RJS Barcode ActiveX Object

Go to START > RUN and run the following command to register the RJS Barcode ActiveX:

C:\WSPEFORM\RJSBARCODE.EXE


Using the RJS Barcode ActiveX for scripting.

Available Barcode Types

 0-EAN                     30-PostNet-Cp
 1-EAN-8                   31-FIM A
 2-EAN+2                   32-FIM B
 3-EAN+5                   33-FIM C
 4-UPC-A                   34-RM4SCC
 5-UPC-E                   35-4-State
 6-ITF                     36-Code-93
 7-ITF-6                   37-Ex Code93
 8-Code-39                 38-ISBN_
 9-Code-128                39-Matrix 2/5
10-EAN-128                 40-Plessey
11-2 of 5                  41-AustraliaP
12-I-2/5                   42-Swiss
13-3 of 9                  43-DeutscheP
14-CODE-B                  44-SICI
15-Code 11                 45-EAN-14
16-Codabar                 46-Planet 12
17-MSI                     47-Planet 14
18-Ex Code39               48-ISSN
19-UPCA+2                  49-ISMN
20-UPCA+5                  50-SSCC
21-EAN8+2                  51-KoreanPA
22-EAN8+5                  52-Poste Itanliane 39
23-UPCE+2                  53-Poste Itanliane 25
24-UPCE+5                  54-ISBN+2
25-Telepen                 55-ISBN+5
26-Telepen A               56-ISSN+2
27-Telepen N               57-ISSN+5
28-PostNet-A               58-JapanPost
29-PostNet-C


Function Description

These are the parameters that must be entered when creating the actual barcode using the GenBarcode method.

Function Name:
GenBarCode
Purpose:
This function generates a barcode bitmap image based on the selected information and passes the barcode file back to the selected file name.
Parameters:
1 - Barcode Text Value - String
2 - Barcode Output Type - Integer
3 - Barcode Output Path - String
4 - Optional barcode width - Integer(Default = 30)
5 - Optional barcode height - Integer(Default = 15)
6 - Optional show barcode text caption - Integer(Default = 0 - No Show)
7 - Optional barcode text caption font size - Integer(Default = 10)
Returns:
Path and file name of the new barcode as a string
Error:
Returns an empty string - ""


Scripting Barcodes Into The Form

Opening the FormDocs Script Editor

For assistance, please reference the FormDocs Automation Basic Editor - Scripting Samples article.


Sample of using the RJS Barcode AcvtiveX

'***************************************************************************************************
'Sample Barcode VB Script Code (updated 8/23/05)
'***************************************************************************************************
Dim bc As Object
Dim bcfile As String
Dim rtn As Long

'Create barcode object
Set bc = CreateObject("RJSBarcode.CRJSBarcode")

'Make directory if not found
rtn = bc.MakeDirectory("c:\barcodes")

'Use one example from the three below.  Comment out the others.

' 1.
'Try to gen barcode with default size and no barcode text
bcfile = bc.GenBarcode("123345", 13, "c:\barcodes",0,0,0,0)

'     - or -

' 2.
'Try to gen barcode with new size and barcode text at 5 points. 
bcfile = bc.GenBarcode("123345", 13, "c:\barcodes",10,5,1,5)

'     - or -

' 3.
'Try to gen barcode using the value in a field on the form. 
'For this example, we will call the field "YOUR_FIELD".  Replace this with a field that exists on your form. 
bcfile = bc.GenBarcode(ThisForm.Fields("YOUR_FIELD").value, 13, "c:\barcodes",10,5,1,5)


'If no file name is returned, an error occurred generating barcode. 
'If a file name is returned, bcfile can be moved into a FormDocs field. 
'NOTE: IF you use the field name below, you MUST have a field named "BARCODE_FIELD" that is set to a 'Picture' Format. 

If bcfile = "" Then
   MsgBox "No barcode"
Else
   ThisForm.Fields("BARCODE_FIELD").activate
   ThisForm.Fields("BARCODE_FIELD").value = bcfile
End If

'Delete work file
rtn = bc.DeleteFile(bcfile)

'Release barcode object
Set bc = Nothing
Personal tools