VBScripting Example

The following VBScript shows how to create a tool that will read the value of a barcode from an image and write the value to a text file. Make sure that SofteATL.dll has been registered before attempting to run. This can be done by right clicking on REGISTER.BAT and selecting “Run as Administrator”.

myscript.vbs

Dim input, output
If WScript.Arguments.Count <> 2 Then
   MsgBox("Usage myscript.vbs input_image output_text")
   WScript.Quit
End If
Set oBarcode = CreateObject("SoftekATL.Barcode")
Set oArgs = WScript.Arguments.Unnamed 
input = oArgs.Item(0)
output = oArgs.Item(1)
oBarcode.ScanBarCode(input)
n = oBarcode.BarCodeCount
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.CreateTextFile(output)
If n > 0 Then
   f.WriteLine(oBarcode.barstring(1))
End If

On most systems the above script could be called as follows:

myscript.vbs <input image> <output text>

Example:

myscript.vbs input.tif output.txt

Note that the above script is only an example and is not part of our supported toolkit.